jekyll/jekyll

[Bug]: Following the instructions on the home page results in "cannot load such file -- json (LoadError)"

KonradHoeffner opened this issue · 3 comments

Operating System

Archlinux 6.7.4-arch1-1

Ruby Version

ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]

Jekyll Version

jekyll 4.3.3

GitHub Pages Version

No response

Expected Behavior

As written on the home page https://jekyllrb.com/ I was expecting # => Now browse to http://localhost:4000.

Current Behavior

bundle exe jekyll serve results in bundler: failed to load command: jekyll (/home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll)

Relevant log output

bundler: failed to load command: jekyll (/home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll)
/home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/lib/jekyll.rb:29:in `require': cannot load such file -- json (LoadError)
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/lib/jekyll.rb:29:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/exe/jekyll:8:in `require'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/exe/jekyll:8:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll:25:in `load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll:25:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in `run'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in `exec'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in `dispatch'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in `start'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/exe/bundle:28:in `block in <top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/exe/bundle:20:in `<top (required)>'
	from /usr/bin/bundle:25:in `load'
	from /usr/bin/bundle:25:in `<main>'

Code Sample

$ pacman -S ruby
...(pacman output hidden for brevity)
$ gem install bundler jekyll
Successfully installed bundler-2.5.6
Parsing documentation for bundler-2.5.6
Done installing documentation for bundler after 0 seconds
Successfully installed jekyll-4.3.3
Parsing documentation for jekyll-4.3.3
Done installing documentation for jekyll after 0 seconds
2 gems installed
$ jekyll new x
Running bundle install in /tmp/x... 
  Bundler: Bundle complete! 7 Gemfile dependencies, 33 gems now installed.
  Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /tmp/x. 
$ cd x
x$ bundle exec jekyll serve
bundler: failed to load command: jekyll (/home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll)
/home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/lib/jekyll.rb:29:in `require': cannot load such file -- json (LoadError)
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/lib/jekyll.rb:29:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/exe/jekyll:8:in `require'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/jekyll-4.3.3/exe/jekyll:8:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll:25:in `load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/bin/jekyll:25:in `<top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in `run'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in `exec'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in `dispatch'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in `start'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/exe/bundle:28:in `block in <top (required)>'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /home/konrad/.local/share/gem/ruby/3.0.0/gems/bundler-2.5.6/exe/bundle:20:in `<top (required)>'
	from /usr/bin/bundle:25:in `load'
	from /usr/bin/bundle:25:in `<main>'

I am seeing this issue as well (also on archlinux). As a workaround, adding gem "json" to my Gemfile worked, but I don't understand what's causing this, as I have the arch extra/ruby-json package installed.

json is meant to be a default gem that is installed with Ruby. Arch breaks this and doesn't install json as a default gem. Please file an issue with the Arch folks. This is not something we'll fix as part of the Jekyll project.

vzx7 commented

gem "json" in project's Gemfile for Arch Linux work for me! Cool! Thanks!