jekyll serve并不是因为依赖性错误而工作

时间:2018-04-07 05:40:23

标签: ruby jekyll github-pages

尝试在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·

我试图通过以下方式解决错误:jekyll serve shows a dependency error,但它没有用。

  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>'
    

2 个答案:

答案 0 :(得分:3)

删除 Gemfile.lock 文件,然后再次运行bundle install

这是@ashmaroli在评论中建议的内容,并且有效。

答案 1 :(得分:1)

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

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

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

这意味着gem ruby_dep未正确安装。 (ruby_depjekyll-watch

的二阶依赖关系

所以,这里的问题是,

“您完全可以完成bundle install而没有任何错误?”

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

$ ridk install