Jekyll 运行的时候提示错误 cannot load such file -- webrick (LoadError)

完整的错误信息如下:

LinkChecker: [Warning]
                    done in 13.838 seconds.
 Auto-regeneration: enabled for 'D:/WorkDir/Repository/GitHub/opensearch/documentation-website'
                    ------------------------------------------------
      Jekyll 4.2.1   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/servlet.rb:3:in `require': cannot load such file -- webrick (LoadError)
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve/servlet.rb:3:in `<top (required)>'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:179:in `require_relative'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:179:in `setup'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:100:in `process'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `each'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from D:/DKits/Ruby/lib/ruby/gems/3.0.0/gems/jekyll-4.2.1/exe/jekyll:15:in `<top (required)>'
        from D:/DKits/Ruby/bin/jekyll:23:in `load'
        from D:/DKits/Ruby/bin/jekyll:23:in `<main>'

 

 

问题和解决

根据官方的项目的说明:

这是因为:
从 Ruby 3.0 开始 webrick 已经不在绑定到 Ruby 中了,请参考链接: Ruby 3.0.0 Released 中的说明。

webrick 需要手动进行添加。

添加的命令为:

bundle add webrick

后就可以解决这个问题了。

 

https://www.ossez.com/t/jekyll-cannot-load-such-file-webrick-loaderror/13779

posted @ 2021-10-27 21:23  huyuchengus  阅读(1266)  评论(0编辑  收藏  举报