DEV Community

Cover image for Fixing Jekyll/Webrick Issue on Arch Linux
Snehit Sah
Snehit Sah

Posted on • Originally published at flyingcakes85.github.io

Fixing Jekyll/Webrick Issue on Arch Linux

Jekyll may not run on Arch Linux because of an error with webrick. This is caused because webrick is not yet compatible with latest version of Ruby (3.0.1).

This is the relevant line from error output.

/blog/vendor/bundle/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/servlet.rb:3:in require: cannot load such file -- webrick (LoadError)

While setting up my GitHub pages blog, I faced this issue. I'll quickly document how to fix this.

Install Bundle

You will need to have rubygems installed for this.

sudo pacman -S rubygems
Enter fullscreen mode Exit fullscreen mode

Then install bundle via gem.

gem install bundle
Enter fullscreen mode Exit fullscreen mode

Gem will print a warning about not having the local binary folder in your path. Add the following line to your ~/.bashrc or ~/.zshrc depending on the shell you use.

export PATH=/home/$USER/.local/share/gem/ruby/3.0.0/bin:$PATH
Enter fullscreen mode Exit fullscreen mode

Make sure you replace "3.0.0" with the version number gem reports.

Uninstall Ruby

We need to remove the latest Ruby version.

sudo pacman -Rns ruby rubygems
Enter fullscreen mode Exit fullscreen mode

Install Ruby 2.7

Webrick is compatible with Ruby 2.7. This is the version we will install.

sudo pacman -S ruby2.7
Enter fullscreen mode Exit fullscreen mode

Symlink ruby Binary

bundle will call the binary at /usr/bin/ruby. However, the old Ruby version is installed at /usr/bin/ruby-2.7. So we will create a symlink. You will need to uninstall ruby as I said earlier.

sudo ln -s /usr/bin/ruby-2.7 /usr/bin/ruby 
Enter fullscreen mode Exit fullscreen mode

Now, /usr/bin/ruby will just be a symlink (or shortcut in layman terms) to /usr/bin/ruby-2.7.

Run bundle

Go to your Jekyll project directory. Install the dependencies.

bundle install
Enter fullscreen mode Exit fullscreen mode

Then launch your Jekyll site

bundle exec jekyll serve
Enter fullscreen mode Exit fullscreen mode

Your website should be now live! 🚀

You can follow my personal blog at https://flyingcakes85.github.io/blog/

Follow me on GitHub : flyingcakes85

Top comments (0)