jekyll serve 不适用于依赖错误

jekyll serve isn't working for dependency error

在 GitBash(Win10) 中尝试 运行 jekyll 服务时,出现以下错误:

$ jekyll server
Configuration file: D:/Blog/mysite/_config.yml
            Source: D:/Blog/mysite
       Destination: D:/Blog/mysite/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 3.25 seconds.
  Dependency Error: Yikes! It looks like you don't have jekyll-watch or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- ruby_dep/warning' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.7.3 | Error:  jekyll-watch·

我试图通过这些方式解决错误:,但没有成功。

  1. 按照提示,我又安装了jekyll-watch,然后又运行jekyll serve,又出现了同样的错误。换句话说,它对我不起作用。

    $ jekyll server
    Configuration file: D:/Blog/mysite/_config.yml
                Source: D:/Blog/mysite
           Destination: D:/Blog/mysite/_site
     Incremental build: disabled. Enable with --incremental
        Generating...
                      done in 3.25 seconds.
    Dependency Error: Yikes! It looks like you don't have jekyll-watch or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- ruby_dep/warning' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
    jekyll 3.7.3 | Error:  jekyll-watch
    
  2. 我尝试 bundle install,然后 运行 $ bundle exec jekyll serve,另一个错误来了...

    $ bundle exec jekyll serve
    D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll.rb:35:in 'require': cannot load such file -- i18n (LoadError)
            from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/lib/jekyll.rb:35:in '<top (required)>'
            from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/exe/jekyll:8:in 'require'
            from D:/rubyInstall/Ruby25-x64/lib/ruby/gems/2.5.0/gems/jekyll-3.7.3/exe/jekyll:8:in '<top (required)>'
            from D:/rubyInstall/Ruby25-x64/bin/jekyll:23:in 'load'
            from D:/rubyInstall/Ruby25-x64/bin/jekyll:23:in '<main>'
    

我要求您 post bundle show 的输出的原因是为了评估是否所有依赖项都已成功安装。

如果您查看第一个错误输出,您将看到以下内容:

The full error message from Ruby is: 'cannot load such file -- ruby_dep/warning'

这意味着 gem ruby_dep 没有正确安装。 (ruby_depjekyll-watch 的 second-order 依赖项)

所以,这里的问题是,

"Where you able to finish bundle install completely without any errors?"

如果不是,您可能需要通过以下 运行 为您的 Ruby 版本安装 Ruby Devkit:

$ ridk install

删除 Gemfile.lock 文件并再次 运行 bundle install

这就是@ashmaroli 在评论中提出的建议,并且奏效了。