Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jekyll serve fails on Ruby 3.0 (webrick missing) #752

Open
1 of 2 tasks
Krinkle opened this issue Jan 11, 2021 · 26 comments · May be fixed by #914
Open
1 of 2 tasks

Jekyll serve fails on Ruby 3.0 (webrick missing) #752

Krinkle opened this issue Jan 11, 2021 · 26 comments · May be fixed by #914

Comments

@Krinkle
Copy link

Krinkle commented Jan 11, 2021

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 jekyll/jekyll#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.

@nllerandi3lift
Copy link

nllerandi3lift commented Jan 21, 2021

Ruby 3.0 no longer comes with webrick

bundle add webrick

@parkr
Copy link
Contributor

parkr commented Jan 21, 2021

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!

@ghost
Copy link

ghost commented Jan 28, 2021

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!

This really should be in the official documentation: it's severely lacking small details like this that takes hours digging around to figure out.

@adamfg
Copy link

adamfg commented Feb 7, 2021

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!

This really should be in the official documentation: it's severely lacking small details like this that takes hours digging around to figure out.

Totally. What a way to waste a Sunday trying to solve this after doing the responsible thing and using latest Ruby...

@jp26jp
Copy link

jp26jp commented Feb 26, 2021

Definitely needs to be added to the documentation.

jp26jp added a commit to jp26jp/jekyll that referenced this issue Feb 26, 2021
[Jekyll doesn't work with ruby 3.0.0](github/pages-gem#752 (comment))
@ddnexus
Copy link

ddnexus commented Mar 5, 2021

Definitely needs to be upgraded to support Ruby 3.0

designmeme added a commit to designmeme/designmeme.github.io that referenced this issue Mar 18, 2021
- github-pages gem이 Ruby3 버전을 지원하지 않아서 따로 추가해서 해결
- github/pages-gem#752 (comment)
@Y2Data
Copy link

Y2Data commented Mar 18, 2021

bundle add webrick

This saved me while I was trying to run "bundle exec jekyll serve"

@pradyunsg
Copy link

Can we add the information about what is the current version of Ruby being used to build Github pages to the README?

@parkr
Copy link
Contributor

parkr commented Apr 3, 2021

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:

ruby versions["ruby"]

This will tell bundler to use the ruby version that GitHub Pages uses.

@parkr
Copy link
Contributor

parkr commented Apr 3, 2021

If anyone would like to submit a PR to update the README, I'd be happy to review. I'll try to update the README soon if not.

@adrienjoly
Copy link

As suggested in imagej/imagej.github.io#133, adding gem 'webrick' to Gemfile fixed the problem on my end. Thank you!

cgallegu added a commit to cgallegu/blog that referenced this issue Jun 10, 2021
Ruby 3.0 no longer comes with webrick.

issue: github/pages-gem#752
marccarre added a commit to vie-en-yoga/vie-en-yoga.github.io that referenced this issue Jul 4, 2021
@letisiapangataa
Copy link

Ruby 3.0 no longer comes with webrick

bundle add webrick

Exactly what I was looking for! Thank you.

TonnyGaric pushed a commit to TonnyGaric/tonnygaric.github.io that referenced this issue Jul 17, 2021
@lwasser
Copy link

lwasser commented Aug 9, 2021

adding webrick worked for me too running ruby 3.x

kronaemmanuel added a commit to kronaemmanuel/jekyll that referenced this issue Aug 21, 2021
Since Ruby version 3.0.0 or higher do not come with [webrick](github/pages-gem#752). There is already a warning on the [Quickstart](https://jekyllrb.com/docs/) page. This change adds a similar warning on the `01-setup.md`.

Alternatively, a warning can also be added on line 34 to put in `gem "webrik"` if using Ruby version >= 3.0.0.
@cvegagimenez
Copy link

Running bundle add webrick && bundle exec jekyll serve still leaves me with a bundler: failed to load command: jekyll... My Gemfile reads

source 'https://rubygems.org'

gem 'jekyll', '3.8.5'

group :jekyll_plugins do
  gem 'jekyll-paginate'
  gem 'jekyll-sitemap'
end

gem "webrick", "~> 1.7"

Any ideas? Thanks!

Try deleting the Gemfile.lock and re-run bundle install

It worked for me.

@tianon
Copy link

tianon commented May 26, 2023

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/). 😬

@harriott
Copy link

@parkr, GitHub Pages is now using jekyll 3.9.3, and this is still an issue...

@Hninthiri09
Copy link

@i'm

@nickmccurdy
Copy link

nickmccurdy commented Aug 27, 2023

This has already been fixed as of Jekyll 4.3.0.

If you're using GitHub Pages (like @harriot) I'd recommend using the official GitHub Actions (starter workflow).

yndajas added a commit to dxw/tech-radar that referenced this issue Nov 13, 2023
- Run `bundle update` to update dependencies
- Add `webrick` per [this solution][1] and [this issue][2] - Jekyll
  `4.3.0` fixes this but the `github-pages` gem is using `3.9.3`

[1]: https://stackoverflow.com/a/70916831/4002016
[2]: github/pages-gem#752
yndajas added a commit to dxw/node-for-rails-devs that referenced this issue Nov 13, 2023
- Migrate to Ruby 3
- Update `github-pages`
- Add `webrick` per [this solution][1] and [this issue][2] - Jekyll
  `4.3.0` fixes this but the `github-pages` gem is using `3.9.3`

[1]: https://stackoverflow.com/a/70916831/4002016
[2]: github/pages-gem#752
lithiumhead added a commit to lithiumhead/lithiumhead.github.io that referenced this issue Nov 27, 2023
toothbrush added a commit to toothbrush/toothbrush.github.io that referenced this issue Dec 29, 2023
tianon added a commit to tianon/dockerfiles that referenced this issue Jan 13, 2024
rickstaa added a commit to rickstaa/awesome-livepeer that referenced this issue Feb 5, 2024
This commit downgrades the ruby verison in the awesome-bot job to the
version that is supported by the
[github-pages gem](github/pages-gem#752 (comment)).
rickstaa added a commit to rickstaa/awesome-livepeer that referenced this issue Feb 5, 2024
This commit downgrades the ruby verison in the awesome-bot job to the
version that is supported by the
[github-pages gem](github/pages-gem#752 (comment)).
remarkablemark added a commit to remarkablemark/remarkablemark.github.io that referenced this issue Feb 9, 2024
```
bundler: failed to load command: jekyll
`require': cannot load such file -- webrick (LoadError)`
```

github/pages-gem#752
@mrmanc mrmanc linked a pull request Mar 22, 2024 that will close this issue
kalenkovich added a commit to BergelsonLab/bergelsonlab.github.io that referenced this issue Mar 22, 2024
bundle add webrick

Apparently, github-pages are built using Ruby 2 and Ruby 3 doesn't include a gem called webrick. See github/pages-gem#752 for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.