eecs485staff / primer-spec

A Jekyll theme for sites with content-heavy pages
https://eecs485staff.github.io/primer-spec/
MIT License
22 stars 13 forks source link

jekyll 3.9.5 | Error: undefined method `inject_metadata!' for nil:NilClass #261

Closed jtc1246 closed 8 months ago

jtc1246 commented 8 months ago

I followed the steps in "Previewing locally". But I encountered this problem when running "bundle exec jekyll serve". How can I solve this? I am using macos and ruby 3.1.0.

jekyll 3.9.5 | Error:  undefined method `inject_metadata!' for nil:NilClass

      SiteGitHubMunger.global_munger.inject_metadata!(payload)
                                    ^^^^^^^^^^^^^^^^^
/Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-github-metadata-2.16.1/lib/jekyll-github-metadata/site_github_munger.rb:100:in `block in <module:GitHubMetadata>': undefined method `inject_metadata!' for nil:NilClass (NoMethodError)

      SiteGitHubMunger.global_munger.inject_metadata!(payload)
                                    ^^^^^^^^^^^^^^^^^
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/hooks.rb:103:in `block in trigger'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/hooks.rb:102:in `each'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/hooks.rb:102:in `trigger'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/site.rb:189:in `render'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/site.rb:71:in `process'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/command.rb:28:in `process_site'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/build.rb:65:in `build'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/build.rb:36:in `process'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/serve.rb:93:in `block in start'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/serve.rb:93:in `each'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/serve.rb:93:in `start'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/jekyll-3.9.5/exe/jekyll:15:in `<top (required)>'
        from /Users/jtc/.rbenv/versions/3.1.0/bin/jekyll:25:in `load'
        from /Users/jtc/.rbenv/versions/3.1.0/bin/jekyll:25:in `<top (required)>'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `load'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in `run'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in `exec'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in `dispatch'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in `start'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/exe/bundle:28:in `block in <top (required)>'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /Users/jtc/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.5.6/exe/bundle:20:in `<top (required)>'
        from /Users/jtc/.rbenv/versions/3.1.0/bin/bundle:25:in `load'
        from /Users/jtc/.rbenv/versions/3.1.0/bin/bundle:25:in `<main>'
seshrs commented 8 months ago

Hi @jtc1246! I ran into a similar issue yesterday with CI jobs in this repo, and fixed it with https://github.com/eecs485staff/primer-spec/commit/61d45ac4aa1a07621618e5e15a38399f141fb586.

I wonder if your issue can be fixed by modifying your repo’s Gemfile by adding the line:

gem 'jekyll-github-metadata', '2.13'

And then run bundle update. That should fix your bundle exec jekyll serve command.

I’ll spend some time later to figure out if I can manage Ruby dependencies for all course repos from this repo directly.

jtc1246 commented 8 months ago

solved, thanks

seshrs commented 6 months ago

Just to update, this can be fixed by modifying the Gemfile line for github-pages:

gem 'github-pages', '228'

I'll update the instructions on the "preview locally" docs.