How to fix "Could not find eventmachine-1.2.7" error and "LoadError: cannot load such file -- webrick" in Jekyll?

I wrote a blog post today, and after finishing, I did my usual bundle exec jekyll serve to view what I wrote. Only today, I was met with an error “Error one: Could not find eventmachine-1.2.7 in any of the sources”. The suggestion was to “Run bundle install to install missing gems”.

But when I ran bundle install, it said “listen-3.2.1 requires ruby version ~> 2.2, >= 2.2.7, which is incompatible with the current version, ruby 3.0.0p0”.

So instead of bundle install, I ran bundle update. After my bundle was updated, I tried bundle exec jekyll serve again. This time it was a different error : “`require’: cannot load such file – webrick (LoadError)”.

I ran bundle exec jekyll serve–trace, and it also said, “LoadError: cannot load such file – webrick”.

So I added gem 'webrick' to my Gemfile (you can do bundle add webrick to do the same thing). Then I ran bundle install.

Everything is running smoothly now.

To summarize,

  1. Run bundle update.
  2. Add gem 'webrick' to your Gemfile.
  3. Run bundle install.

I hope this helps.