运行jekyll时发生未初始化的常量Syck错误

时间:2019-01-08 10:03:41

标签: ruby jekyll

使用jekyll,运行命令bundle exec jekyll serve --watch时出现以下错误,

bundler: failed to load command: jekyll (/home/admin/.rbenv/versions/2.3.8/bin/jekyll)
NameError: uninitialized constant Syck
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml/syck_node_monkeypatch.rb:42:in `<top (required)>'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:200:in `require'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:200:in `<module:YAML>'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:132:in `<top (required)>'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/lib/jekyll.rb:21:in `require'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/lib/jekyll.rb:21:in `<top (required)>'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/bin/jekyll:7:in `require'
  /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/bin/jekyll:7:in `<top (required)>'
  /home/admin/.rbenv/versions/2.3.8/bin/jekyll:22:in `load'
  /home/admin/.rbenv/versions/2.3.8/bin/jekyll:22:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:385:in `block in require_program': program version required (Commander::Runner::CommandError)
    from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:384:in `each'
    from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:384:in `require_program'
    from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:52:in `run!'
    from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/delegates.rb:8:in `run!'
    from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/import.rb:10:in `block in <top (required)>'

2 个答案:

答案 0 :(得分:2)

我想与jekyll-1.3.0有关的几行告诉我们,某处存在路径问题。

  • 使用bundle update

  • 更新您的宝石
  • 并使用rbenv rehash进行rehash

答案 1 :(得分:0)

您似乎正在使用Jekyll版本1.3.0,目前该版本大约已有5年的历史了。 Syck已从Ruby 2.0.0中删除,因此我认为您需要使用更新版本的Jekyll或使用Syck gem来缩小差距。 https://github.com/ruby/syck