pages-gem icon indicating copy to clipboard operation
pages-gem copied to clipboard

Jekyll serve fails on Ruby 3.0 (webrick missing)

Open Krinkle opened this issue 3 years ago • 26 comments

This issue affects

  • [ ] The site generated by GitHub Pages
  • [x] 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.

Krinkle avatar Jan 11 '21 02:01 Krinkle

Ruby 3.0 no longer comes with webrick

bundle add webrick

nllerandi3lift avatar Jan 21 '21 13:01 nllerandi3lift

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!

parkr avatar Jan 21 '21 16:01 parkr

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.

ghost avatar Jan 28 '21 14:01 ghost

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...

adamfg avatar Feb 07 '21 12:02 adamfg

Definitely needs to be added to the documentation.

jp26jp avatar Feb 26 '21 09:02 jp26jp

Definitely needs to be upgraded to support Ruby 3.0

ddnexus avatar Mar 05 '21 07:03 ddnexus

bundle add webrick

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

Y2Data avatar Mar 18 '21 13:03 Y2Data

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

pradyunsg avatar Apr 03 '21 09:04 pradyunsg

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 avatar Apr 03 '21 13:04 parkr

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.

parkr avatar Apr 03 '21 14:04 parkr

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

adrienjoly avatar Jun 05 '21 09:06 adrienjoly

Ruby 3.0 no longer comes with webrick

bundle add webrick

Exactly what I was looking for! Thank you.

letisiapangataa avatar Jul 11 '21 11:07 letisiapangataa

adding webrick worked for me too running ruby 3.x

lwasser avatar Aug 09 '21 18:08 lwasser

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.

fulldecent avatar Nov 29 '21 03:11 fulldecent

I'm confused. I ran up against the same problem, but I can't see in this thread how to repair matters. Is there a simple straightforward recipe?

billbennettnz avatar Jan 11 '22 06:01 billbennettnz

Adding webrick didn't help:

blog on  master [✘!] via 💎 v3.1.0 
➜ bundle info webrick                    
  * webrick (1.7.0)
        Summary: HTTP server toolkit
        Homepage: https://github.com/ruby/webrick
        Bug Tracker: https://github.com/ruby/webrick/issues
        Path: /home/user/.gems/gems/webrick-1.7.0

blog on  master [✘!] via 💎 v3.1.0 
➜ bundle exec jekyll serve --host 0.0.0.0
Configuration file: /home/user/Documents/Workspace/VCServers/GitLab/blog/_config.yaml
            Source: /home/user/Documents/Workspace/VCServers/GitLab/blog
       Destination: /home/user/Documents/Workspace/VCServers/GitLab/blog/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
                    done in 1.901 seconds.
jekyll 3.9.0 | Error:  no implicit conversion of Hash into Integer
/home/user/.gems/gems/pathutil-0.16.2/lib/pathutil.rb:502:in `read': no implicit conversion of Hash into Integer (TypeError)

any suggestions?

yozachar avatar Jan 31 '22 15:01 yozachar

@joe733 That's caused by https://github.com/envygeeks/pathutil/pull/5 being unmerged.

danielhjacobs avatar Feb 22 '22 22:02 danielhjacobs

Ruby 3.0 no longer comes with webrick

bundle add webrick

This saved me....

Swapnil7711 avatar Mar 28 '22 08:03 Swapnil7711

Ruby 3.0 no longer comes with webrick

bundle add webrick

JFYI, still need it for ruby 3.1.1p18 and jekyll 4.2.2.

dudung avatar May 09 '22 00:05 dudung

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!

collinsinclair avatar Aug 20 '22 23:08 collinsinclair

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

PSNAppz avatar Jan 24 '23 05:01 PSNAppz

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.

cvegagimenez avatar Jan 25 '23 12:01 cvegagimenez

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/). :grimacing:

tianon avatar May 26 '23 03:05 tianon

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

harriott avatar Jun 12 '23 17:06 harriott

@I'm

Hninthiri09 avatar Aug 27 '23 18:08 Hninthiri09

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

nickmccurdy avatar Aug 27 '23 21:08 nickmccurdy