pages-gem: Jekyll serve fails on Ruby 3.0 (webrick missing)
This issue affects
- The site generated by GitHub Pages
- Building sites locally
What did you do (e.g., steps to reproduce)
bundle exec jekyll serve
On macOS 10.15 with Ruby 3.0.0 from Homebrew, using the latest github-pages in a Gemfile.
# Gemfile
gem "github-pages"
# Gemfile.lock:
github-pages (209)
jekyll (= 3.9.0)
…
What happened instead?
bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll)
/usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:in `require_relative'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:in `setup'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:102:in `process'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `block in start'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `each'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `start'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /usr/local/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/exe/jekyll:15:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `load'
from /usr/local/lib/ruby/gems/3.0.0/bin/jekyll:23:in `<top (required)>'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli.rb:497:in `exec'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/exe/bundle:49:in `block in <top (required)>'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/gems/3.0.0/gems/bundler-2.2.3/exe/bundle:37:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/bin/bundle:23:in `load'
from /usr/local/lib/ruby/gems/3.0.0/bin/bundle:23:in `<main>'
Additional information
Reported upstream at https://github.com/jekyll/jekyll/issues/8523. Upstream has fixed this in the main branch for the next Jekyll 4 release, however this is unlikely to benefit GitHub Pages anytime soon, so it might be good to add this here for the time being.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 18
- Comments: 26 (3 by maintainers)
Commits related to this issue
- Added max ruby version [Jekyll doesn't work with ruby 3.0.0](https://github.com/github/pages-gem/issues/752#issuecomment-764758292) — committed to jp26jp/jekyll by jp26jp 3 years ago
- webrick gem 추가 - github-pages gem이 Ruby3 버전을 지원하지 않아서 따로 추가해서 해결 - https://github.com/github/pages-gem/issues/752#issuecomment-764647862 — committed to designmeme/designmeme.github.io by designmeme 3 years ago
- Build: Fix local use with Ruby 3.0 Ref https://github.com/github/pages-gem/issues/752. — committed to qunitjs/jekyll-theme-amethyst by Krinkle 3 years ago
- Build: Fix local use with Ruby 3.0 Ref https://github.com/github/pages-gem/issues/752. — committed to qunitjs/jekyll-theme-amethyst by Krinkle 3 years ago
- deps: add webrick Ruby 3.0 no longer comes with webrick. issue: https://github.com/github/pages-gem/issues/752 — committed to cgallegu/blog by cgallegu 3 years ago
- fix: add missing library 'webrick' This is to work around: - https://github.com/jekyll/jekyll/issues/8523 - https://github.com/github/pages-gem/issues/752 — committed to vie-en-yoga/vie-en-yoga.github.io by marccarre 3 years ago
- Added webrick with "bundle add webrick", because of https://github.com/github/pages-gem/issues/752 — committed to TonnyGaric/tonnygaric.github.io by deleted user 3 years ago
- Add warning about `webrick` to 01-setup.md Since Ruby version 3.0.0 or higher do not come with [webrick](https://github.com/github/pages-gem/issues/752). There is already a warning on the [Quickstart... — committed to kronaemmanuel/jekyll by kronaemmanuel 3 years ago
- Add webrick as explicit gem in Ruby 3.X https://github.com/github/pages-gem/issues/752#issuecomment-764647862 — committed to petervandenabeele/ClimateData.be by petervandenabeele 3 years ago
- Add webrick gem to Gemfile - See https://github.com/github/pages-gem/issues/752 — committed to phrdang/phrdang.github.io by phrdang 3 years ago
- Fix "cannot load such file -- webrick" error in jekyll serve See https://github.com/github/pages-gem/issues/752 — committed to bradfeehan/bradfeehan.github.io by bradfeehan 3 years ago
- Fix "cannot load such file -- webrick" error in jekyll serve See https://github.com/github/pages-gem/issues/752 — committed to bradfeehan/bradfeehan.github.io by bradfeehan 3 years ago
- add webrick — committed to adibdz/hackfest by adibdz 3 years ago
- Update gems for Ruby 3.0 ref github/pages-gem#752 — committed to victorlin/victorlin.github.io by victorlin 3 years ago
- add webrick, as per: https://github.com/github/pages-gem/issues/752 — committed to bitkarrot/bitcoinhk.github.io by bitkarrot 2 years ago
- Added webrick. Needed for Ruby 3.x compatibility. See: * https://jekyllrb.com/docs/ * https://github.com/github/pages-gem/issues/752 — committed to SuperSonicHub1/jekyll-asciidoc-quickstart by SuperSonicHub1 3 years ago
- updated gemfile added webrick because of https://github.com/github/pages-gem/issues/752 — committed to sammeltassen/gillys-library by sammeltassen 2 years ago
- Install webrick dependency for Ruby 3.x webrick is no longer included in Ruby 3.0. GitHub Pages itself uses Ruby 2.7. https://github.com/github/pages-gem/issues/752 — committed to toronto-riichi-club/toronto-riichi-club.github.io by jmbtutor 2 years ago
- Add pulsar rules (#286) * Add pulsar rules * Add webrick, cf.: - https://github.com/github/pages-gem/issues/752 * Update gems (minitest / ruby 3 issue) * Add repo info (workaround), cf. - ... — committed to samber/awesome-prometheus-alerts by mkoertgen 2 years ago
- chore(deps): bump octokit from 4.23.0 to 4.25.0 * bundle add webrick (see https://github.com/github/pages-gem/issues/752) — committed to Orange-OpenSource/ods-jekyll-theme by julien-deramond 2 years ago
Ruby 3.0 no longer comes with webrick
bundle add webrick
This really should be in the official documentation: it’s severely lacking small details like this that takes hours digging around to figure out.
Definitely needs to be added to the documentation.
This saved me while I was trying to run “bundle exec jekyll serve”
Totally. What a way to waste a Sunday trying to solve this after doing the responsible thing and using latest Ruby…
Definitely needs to be upgraded to support Ruby 3.0
Hi! In general, we recommend (and support) running the github-pages gem with the Ruby version we’re running in production (2.7.x). We don’t yet support Ruby 3.0.0. Ruby 2.7.x still has webrick so I’d recommend using that until we’ve upgraded for your GitHub Pages needs!
All of the latest versions we’re running on GitHub Pages are shown here: https://pages.github.com/versions/
There’s even a JSON endpoint: https://pages.github.com/versions.json
I wrote a blog post a while back about staying up to date by using that endpoint. Not sure how well it works today but you could add to your gemfile:
This will tell bundler to use the ruby version that GitHub Pages uses.
Running
bundle add webrick && bundle exec jekyll serve
still leaves me with abundler: failed to load command: jekyll
… My Gemfile readsAny ideas? Thanks!
Exactly what I was looking for! Thank you.
It worked for me.
Try deleting the
Gemfile.lock
and re-runbundle install
This is probably a bit more serious now that 2.7 is End of Life (https://www.ruby-lang.org/en/news/2023/03/30/ruby-2-7-8-released/). 😬
JFYI, still need it for
ruby 3.1.1p18
andjekyll 4.2.2
.In this issue I understand that Jekyll does not support Ruby 3 for macOS. But the documentation at https://jekyllrb.com/docs/installation/macos/ shows the example of using Ruby 3.
adding webrick worked for me too running ruby 3.x