Error: no implicit conversion of Hash into Integer

Hi. I’m trying to follow the github-pages guide for jekyll. I’m not having much luck. because it keeps crashing when I run:

$ bundle exec jekyll serve     
Configuration file: /home/user/Documents/blog/docs/_config.yml
            Source: /home/user/Documents/blog/docs
       Destination: /home/user/Documents/blog/docs/_site
Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 0.223 seconds.
jekyll 3.9.0 | Error:  no implicit conversion of Hash into Integer
/home/user/.local/share/gem/ruby/3.0.0/gems/pathutil-0.16.2/lib/pathutil.rb:502:in `read': no implicit conversion of Hash into Integer (TypeError)
        from /home/user/.local/share/gem/ruby/3.0.0/gems/pathutil-0.16.2/lib/pathutil.rb:502:in `read'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-3.9.0/lib/jekyll/utils/platforms.rb:75:in `proc_version'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-3.9.0/lib/jekyll/utils/platforms.rb:40:in `bash_on_windows?'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:77:in `watch'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:43:in `process'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `block in start'

I installed bundle and jekyll the reccomended way

The version of jekyll available in my path is 4.2.0. I discovered this by running jekyll -v. But I had to run this outside of the project directory. if I run jekyll -vin the poject directory it gives the following output

$ jekyll -v
/home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/runtime.rb:302:in `check_for_activated_spec!': You have already activated i18n 1.8.10, but your Gemfile requires i18n 0.9.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/runtime.rb:31:in `block in setup'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/spec_set.rb:152:in `each'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/spec_set.rb:152:in `each'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/runtime.rb:26:in `map'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler/runtime.rb:26:in `setup'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/bundler-2.2.16/lib/bundler.rb:148:in `setup'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-4.2.0/lib/jekyll/plugin_manager.rb:52:in `require_from_bundler'
        from /home/user/.local/share/gem/ruby/3.0.0/gems/jekyll-4.2.0/exe/jekyll:11:in `<top (required)>'
        from /home/user/.local/share/gem/ruby/3.0.0/bin/jekyll:23:in `load'
        from /home/user/.local/share/gem/ruby/3.0.0/bin/jekyll:23:in `<main>'

Any ideas why this is?

Thank you

Github-Pages uses Jekyll 3.9, which isn’t compatible with Ruby 3. Downgrading to Ruby 2.7 should avoid the problem.

Yes agree to Ruby 2.7. And don’t use plain global jekyll which is 4.

Within your project only use bundle exec jekyll which 3.9 and that is the appropriate version for GH Pages.

If you still have issues, check your config and frontmatter and any references to paths in your files. It looks like an unexpected data type on your code. But then again it might not be your code and it is a system issue.

If you can move all your content of your repo temporarily to another directory so you only have Gemfile, vendor and an almost empty index.md (not even config), then you can run the serve command there and then you’ll see that Jekyll can work alone. Then start bringing your code back in to the directory and see which file causes a break if at all.

You can also setup a new directory locally to test Jekyll itself using a template

cd my-repo
bundle exec jekyll new ~/repos/test
cd !$   # Same as cd ~/repos/test

# maybe bundle install steps.
# ...

bundle exec jekyll serve --trace

Please provide a repo link too if you figure out that you can get Jekyll to run for a new project but not your existing one.

@MichaelCurrin Please inspect this repo GitHub - abusayed0206/abusayed0206.github.io: A personal website for share my thoughts/tweaks etc!

It has same error:

Error log from terminal:
2021-06-12 09:48:08 - TypeError - no implicit conversion of Hash into Integer:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-manager-0.1.1/lib/jekyll-admin/server/configuration.rb:36:in read' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-manager-0.1.1/lib/jekyll-admin/server/configuration.rb:36:in raw_configuration’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-manager-0.1.1/lib/jekyll-admin/server/configuration.rb:7:in block (2 levels) in <class:Server>' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in block in compile!' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in block (3 levels) in route!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in
route_eval' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in block (2 levels) in route!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in block in process_route' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in catch’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in process_route' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in block in route!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in
each' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in route!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in block in dispatch!' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in block in invoke’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in catch' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in invoke’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in dispatch!' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in block in call!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in block in invoke' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in catch’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in invoke' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in call!’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in
call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/xss_header.rb:18:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/path_traversal.rb:16:in call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/json_csrf.rb:18:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/base.rb:49:in call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/base.rb:49:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-protection-1.5.5/lib/rack/protection/frame_options.rb:31:in call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-1.6.13/lib/rack/nulllogger.rb:9:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-1.6.13/lib/rack/head.rb:13:in call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in call' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in block in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1787:in synchronize' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in call’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rack-1.6.13/lib/rack/handler/webrick.rb:88:in service' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/webrick-1.7.0/lib/webrick/httpserver.rb:140:in service’
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/webrick-1.7.0/lib/webrick/httpserver.rb:96:in run' C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/webrick-1.7.0/lib/webrick/server.rb:310:in block in start_thread’

The error is in Jekyll Manager

So disable this line in Gemfile and serve again

gem 'jekyll-manager', group: :jekyll_plugins

Also I recommend deleting Node modules and adding dir to gitignore. You don’t need to add that to git.

Thanks. I installed the appropriate versions.

1 Like

I have the same error, I don’t use GitHub pages and I don’t have jekyll-manager in Gemfile.

I use:

bundle exec jekyll serve

and Jekyll’s serve doesn’t work. Any tips on how to make it work? Or is deleting Jekyll and use something else the only option? I want to migrate to Eleventy that just works and use Node instead of Ruby that keep adding breaking changes that prevent Jekyll to run.

PS: I use Fedora.

I would open a new thread and post your full output and a link to your repo if possible.

Or use something else, keep in mind we’re all just here volunteering to try and help others, no one is going to stop you from trying something else.

It seems it’s not documented but Jekyll doesn’t work fully with Ruby 3.0. At least on Linux because of some dependency:

https://bbs.archlinux.org/viewtopic.php?id=265534

Mainly pathutil.