【问题标题】:Error while locally launching GitHub pages Jekyll page本地启动 GitHub 页面 Jekyll 页面时出错
【发布时间】:2021-08-31 15:22:38
【问题描述】:

我正在使用 Jekyll 构建一个 GitHub 页面网站。我想在本地运行这个网站,但不幸的是我有很多错误。

我正在运行此命令以在 localhost 上启动我的网站

我遵循了这个教程:https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll

bundle exec jekyll serve

这些是我得到的错误:

$ bundle exec jekyll serve --incremental
                    done in 0.376 seconds.
 Auto-regeneration: enabled for 'D:/melmasset.github.io'
C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:in `require_relative'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:184:in `setup'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:102:in `process'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `block in start'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `each'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `start'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from C:/Ruby30/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/exe/jekyll:15:in `<top (required)>'
        from C:/Ruby30/bin/jekyll:23:in `load'
        from C:/Ruby30/bin/jekyll:23:in `<main>'

问我是否需要其他适应症:)

【问题讨论】:

标签: ruby jekyll github-pages


【解决方案1】:

这是一个已知问题with ruby 3 not having webrick by default anymore
好消息是the issue has already been fixed,遗憾的是这不适用于last 4.2 jekyll 版本,only in master,所以你的选择是:

  • 使用 bundle add webrick 将 webrick 添加到您的项目包中

  • 手动安装 gem,以获得最后的更改,使用:

git clone https://github.com/jekyll/jekyll.git
cd jekyll
gem build jekyll.gemspec
gem install jekyll-4.2.0.gem
  • 降级到 ruby​​ 2.7

【讨论】:

  • 非常感谢
猜你喜欢
  • 2021-04-21
  • 2017-11-12
  • 1970-01-01
  • 2015-04-08
  • 2021-08-11
  • 2011-02-25
  • 2013-06-26
  • 2018-04-01
  • 1970-01-01
相关资源
最近更新 更多