Tag Archives: Problems encountered in building Jekyll blog by GitHub pages

[Solved] Jekyll Install Error: cannot load such file — webrick (LoadError)

Jekyll install cannot load such file – webrick (LoadError)

catalogue

Jekyll installation cannot load such file — webrick (LoadError) fast track problem background, problem analysis and solution summary

Express Lane

bundle add webrick


Problem background

I use archlinux. Recently, on a whim, I wanted to build a blog on GitHub pages. I looked for it and found two mainstream ones, one is Jekyll and the other is hexo. I heard that the previous one has richer functions, but the syntax is not friendly to programmers, and someone around me uses hexo, but I chose the former, which has rich functions and attracts me more.
but I followed the quick start on the home page

  ~ $ gem install bundler jekyll

  ~ $ jekyll new my-awesome-site

  ~ $ cd my-awesome-site

  ~/my-awesome-site $ bundle exec jekyll serve

# => Now browse to http://localhost:4000

When starting the service in the last step, it reports an error

cannot load such file -- webrick (LoadError)

Problem analysis

After checking a bunch of things on the Internet, we finally found the answer from the official website. The problem is solved by the official documents and is
UE (which tells us that the official documents and GitHub issue are preferred for problems). Through the official website, we can know that we can solve the problem by running bundle add webrick : QuickStart https://jekyllrb.com/docs/,

From the answer given in the issue link on the official website, we can know that ruby3.0.0 and above will no longer bring their own webrick and need to be manually added to the environment

Solution:

Add webrick to dependency: bundle add webrick
this should be implemented in the project

In addition, I tossed around some things, which should not have much to do with the solution of the problem
if webrick does not exist, I can use gem installation: gem install webrick
in addition, I also installed GitHub pages: gem install GitHub pages

Summary

Read more official documents and turn to issue