3

I am following this link to setup my personal website on Github. The website has been deployed successfully and I can visit it now.

My ruby version is 3.3.0 and my gem version is 3.5.4. I have also added webrick mentioned in this link.

However, I can't build it locally after running bundle install and bundle exec jekyll serve. The error is

jekyll 3.9.3 | Error:  undefined method `[]' for nil
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll/log_adapter.rb:43:in `adjust_verbosity'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll/configuration.rb:157:in `config_files'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll.rb:113:in `configuration'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll/command.rb:43:in `configuration_from_options'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:89:in `start'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
    from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.3/exe/jekyll:15:in `<top (required)>'
    from /usr/local/lib/ruby/gems/3.3.0/bin/jekyll:25:in `load'
    from /usr/local/lib/ruby/gems/3.3.0/bin/jekyll:25:in `<top (required)>'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli/exec.rb:58:in `load'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli/exec.rb:58:in `kernel_load'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli/exec.rb:23:in `run'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli.rb:451:in `exec'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli.rb:34:in `dispatch'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/cli.rb:28:in `start'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/exe/bundle:28:in `block in <top (required)>'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.5/exe/bundle:20:in `<top (required)>'
    from /usr/local/lib/ruby/gems/3.3.0/bin/bundle:25:in `load'
    from /usr/local/lib/ruby/gems/3.3.0/bin/bundle:25:in `<main>'

My _config.yml is

# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
#
# If you need help with YAML syntax, here are some quick references for you:
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
# https://learnxinyminutes.com/docs/yaml/
#
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.

title: username
email: [email protected]
description: >- # this means to ignore newlines until "baseurl:"
  Write an awesome description for your new site here. You can edit this
  line in _config.yml. It will appear in your document head meta (for
  Google search results) and in your feed.xml site description.
baseurl: / # the subpath of your site, e.g. /blog
url: https://username.github.io # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: username
github_username:  username

# Build settings
theme: minima
plugins:
  - jekyll-feed

# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
# the internal "default list".
#
# Excluded items can be processed by explicitly listing the directories or
# their entries' file path in the `include:` list.
#
exclude:
  - .sass-cache/
  - .jekyll-cache/
  - gemfiles/
  - Gemfile
  - Gemfile.lock
  - node_modules/
  - vendor/bundle/
  - vendor/cache/
  - vendor/gems/
  - vendor/ruby/

2 Answers 2

5

Fixed by downgrading ruby from 3.3.0 to 3.2.3.

While this technically does work, I don't know that it's a best or recommended practice.

I was struggling with the same issue from above post, and I've recently published a post on medium (actually my first ever post) collecting my findings.

TL;DR - To make a long story short, for easiest way to manage ruby versions, I suggest to install and use rbenv to manage ruby versions, instead of installing via brew or other.

Here's how - don't forget to remove $ from commands:

$ brew install rbenv ruby-build
$ echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
$ source ~/.zshrc

Then install desired ruby version:

$ rbenv install 3.2.3

Finally, either set installed ruby in global, or local scope, or both:

$ rbenv global 3.2.3
$ rbenv local 3.2.3
$ ruby -v
ruby 3.2.3

Finally install bundler gem:

$ gem install bundler
$ bundle -v
Bundler version 2.5.5

Now we're good to go!

2
  • 1
    Perfect response, I've been digging around for way too long after either brew or something else suddenly broke my ruby or bundle installation. This fixed it immediately. Feb 2 at 21:20
  • Glad it helped :-)
    – rv.kvetch
    Feb 8 at 2:47
5

Fixed by downgrading ruby from 3.3.0 to 3.2.3.

1
  • Thanks a lot for this work-around! I had exactly the same issue, fixed it by using 3.2.3 too.
    – Maksim
    Jan 21 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.