bundle exec jekyll serve本地运行失败问题求助
本地构建Jekyll GitHub Pages站点时遭遇NoMethodError错误
环境详情
- Ruby版本:
3.3.0 - gem版本:
3.5.4 - Jekyll版本:
3.9.3 - 已安装
webrick依赖 - 线上GitHub Pages站点已成功部署并可正常访问
问题现象
按照官方流程搭建站点后,线上运行正常,但执行bundle install完成后,运行bundle exec jekyll serve尝试本地构建时失败,抛出如下错误:
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>'
当前站点配置(_config.yml)
# 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: username@gmail.com 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/
内容的提问来源于stack exchange,提问作者wwxiaokucha
相关产品推荐
相关产品推荐

