jekyll: Jekyll serve fails on Ruby 3.0
My Environment
Software | Version(s) |
---|---|
Operating System | Ubuntu 20.04 |
Ruby | 3.0.0 |
jekyll |
4.2.0 |
github-pages |
No |
Expected Behaviour
bundle exec jekyll serve
runs on Ruby 3.0.
Current Behavior
bundle exec jekyll serve
fails with the following stack trace:
/home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:179:in `require_relative'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:179:in `setup'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:100:in `process'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
from /home/argilo/.gem/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from /home/argilo/.gem/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from /home/argilo/.gem/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from /home/argilo/.gem/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from /home/argilo/.gem/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from /home/argilo/.gem/ruby/3.0.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
from /home/argilo/.gem/ruby/3.0.0/bin/jekyll:23:in `load'
from /home/argilo/.gem/ruby/3.0.0/bin/jekyll:23:in `<top (required)>'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:497:in `exec'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:49:in `block in <top (required)>'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /home/argilo/.rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/libexec/bundle:37:in `<top (required)>'
from /home/argilo/.rubies/ruby-3.0.0/bin/bundle:23:in `load'
from /home/argilo/.rubies/ruby-3.0.0/bin/bundle:23:in `<main>'
This happens because webrick is no longer a bundled gem in Ruby 3.0. From https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/:
The following libraries are no longer bundled gems or standard libraries. Install the corresponding gems to use these features.
- sdbm
- webrick
- net-telnet
- xmlrpc
Adding gem "webrick"
to my Gemfile solves the problem, but Jekyll should include it in its gemspec.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 477
- Comments: 82 (13 by maintainers)
Links to this issue
Commits related to this issue
- fix bundle install issues, including https://github.com/jekyll/jekyll/issues/8523 — committed to hrldcpr/poole by hrldcpr 4 years ago
- Add webrick gem to fix jekyll server Check jekyll/jekyll#8523 — committed to luispuerto/luispuerto-net by luispuerto 4 years ago
- Update gemfile https://github.com/jekyll/jekyll/issues/8523 — committed to hteumeuleu/caniemail by hteumeuleu 3 years ago
- [SPARK-34181][DOC] Update Prerequisites for build doc of ruby 3.0 issue ### What changes were proposed in this pull request? When ruby version is 3.0, jekyll server will failed with ``` yi.zhu$ SKIP_... — committed to apache/spark by AngersZhuuuu 3 years ago
- [SPARK-34181][DOC] Update Prerequisites for build doc of ruby 3.0 issue ### What changes were proposed in this pull request? When ruby version is 3.0, jekyll server will failed with ``` yi.zhu$ SKIP_... — committed to apache/spark by AngersZhuuuu 3 years ago
- [SPARK-34181][DOC] Update Prerequisites for build doc of ruby 3.0 issue ### What changes were proposed in this pull request? When ruby version is 3.0, jekyll server will failed with ``` yi.zhu$ SKIP_... — committed to apache/spark by AngersZhuuuu 3 years ago
- [SPARK-34181][DOC] Update Prerequisites for build doc of ruby 3.0 issue ### What changes were proposed in this pull request? When ruby version is 3.0, jekyll server will failed with ``` yi.zhu$ SKIP_... — committed to skestle/spark by AngersZhuuuu 3 years ago
- Update middleman.gemspec to enable Probably to solve the same issue as here: https://github.com/jekyll/jekyll/issues/8523 (I am not really a rubyist, and in fact I'm installing since the ruby 3.0... — committed to fiddlemath/middleman by fiddlemath 3 years ago
- Update middleman.gemspec to enable (#2448) Probably to solve the same issue as here: https://github.com/jekyll/jekyll/issues/8523 (I am not really a rubyist, and in fact I'm installing since the r... — committed to middleman/middleman by fiddlemath 3 years ago
- Support Ruby 3 This adds webrick as gem to support Ruby 3. To the generated documents it has no effect. The corresponding issue is https://github.com/jekyll/jekyll/issues/8523. Author: attilapiros... — committed to apache/spark-website by attilapiros 3 years ago
- add webrick as a gem to resolve jekyll serve issues https://github.com/jekyll/jekyll/issues/8523 — committed to ghevcoul/ghevcoul.github.io by ghevcoul 3 years ago
- Add webrick to Gemfile to prevent error in jekyll >= 3.0 This line was added by running: bundle add webrick Source: jekyll/jekyll#8523 — committed to claremacrae/claremacrae.github.io by claremacrae 3 years ago
- ➕ Add `webrick` to Docs dependencies Ruby 3 no longer bundles `webrick` by default, which is an assumed dependency in [old versions of Jekyll][1]. This change adds it as a dependency to out Docs `Ge... — committed to share/sharedb by alecgibson 3 years ago
- add webrick per https://github.com/jekyll/jekyll/issues/8523 — committed to shefing/shefing.github.io by ShaniZalaznik 3 years ago
- add webrick for jekyll+ruby3; see https://github.com/jekyll/jekyll/issues/8523 — committed to ericlyun/ericlyun.github.io by KireinaHoro 3 years ago
- Add webrick to gemfile for local testing https://github.com/jekyll/jekyll/issues/8523 — committed to hngmn/hngmn.github.io by hngmn 3 years ago
- New Gem requirement for Ruby v3.0.1p64 https://github.com/jekyll/jekyll/issues/8523 — committed to provopoulos/swcv by provopoulos 3 years ago
- Fix for jekyll with Ruby 3.0 as per the https://github.com/jekyll/jekyll/issues/8523 — committed to shospodarets/shospodarets.github.io by shospodarets 3 years ago
- Enable Jekyll to serve on Ruby 3.0 https://github.com/jekyll/jekyll/issues/8523 — committed to mariusbutuc/elixirtoronto by mariusbutuc 3 years ago
- [deps] Add webrick to dependency list Ruby 3.0 doesn't bundle the webrick gem any more. Ref: https://github.com/jekyll/jekyll/issues/8523 — committed to endoflife-date/endoflife.date by captn3m0 3 years ago
I think you want
bundle add webrick
.Thank you @argilo, $
bundle add webrick
works!+1 for the issue with
webrick
, I faced a similar problem when runningjekyll serve
in a different context than the one described here.Thanks, adding
webrick
worked for me.It’s necessary because Jekyll depends on WEBrick, and WEBrick is no longer a bundled gem in Ruby 3.0: https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
I fixed this by adding WEBrick to Jekyll’s gemspec in https://github.com/jekyll/jekyll/pull/8524, but it’s been almost a year and it has yet to be included in a Jekyll release. 😢 The workaround is to manually add
webrick
to yourGemfile
.Why is this issue closed? Dozens of comments in the lines of “fixed! works for me, thanks!” does not mean a problem is resolved.
My environment is a WSL2 Ubuntu LTS (meaning Ubuntu 22.04 running on Windows 10 or 11).
I used the bundler approach and I don’t use the root account, so my step by step was this:
$GEM_HOME
on a vanilla install is an empty string so this is mandatory, or bundler will invoke sudo:This command erased my existing
Gemfile
and.gitignore
, I regret following the site’s instructions:That last command will fail and lead me to one and a half hour learning about ruby, gems, bundler and ultimately to this issue.
There’s a missing step in the instructions somewhere before
bundle install
which is:The default version in this particular environment is currently Jekyll 4.2.2 which does not include webrick in the jekyll.gemspec and therefore it doesn’t get added to Gemfile.
#8524 did not fix this issue so I don’t understand why it’s closed.
This issue will keep happening for everyone until they reach a version where this is fixed, which will take a lot of time.
The very least would be a document notice, but that has been proposed but not implemented.
Big thanks from me as well @argilo You’ve allowed me to stop working before midnight
No, it does not.
@argilo I have the same problem with Ruby 3.2.1 on macOS. Adding
webrick
toGemfile
doesn’t help. Jekyll 3.6.3. Upgrading to Jekyl 4.3.2 solved the problem.That’s correct. The fix was merged into the master branch in January of 2021, but has yet to make it into any release.
This has been fixed, but do I understand correctly that the fix is not yet in any released version of Jekyll?
Pretty dope that this is still an issue.
thanks,u save my day
Both
bundle exec jekyll serve
andjekyll s
work for me ; despite, I’m getting aincompatible library version
forhttp_parser.rb
when appending the--livereload
flag to theserve
command, hence live reload is not active. Working with Ruby 3.0.0 in the MacBook Pro M1 with ARM64 processor. Here’s the log:Please note, as @persistz suggested, after
bundle add webrick
it is advisable to run
bundle update
to make sure other dependencies are updated to work with the new Ruby 3.0 version.