Jekyll Build错误

时间:2016-09-16 16:33:38

标签: ruby jekyll

我正在尝试使用命令jekyll build构建一个jekyll站点。当我运行该命令时,我收到以下错误:

    /usr/local/share/ruby/gems/2.0/gems/bundler-1.13.1/lib/bundler/rubygems_ext.rb:45:in `full_gem_path': uninitialized constant Bundler::Plugin::API::Source (NameError)
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:1393:in `contains_requirable_file?'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:823:in `block in each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:822:in `each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:822:in `each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:67:in `find'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/bundler-1.13.1/lib/bundler/plugin/api/source.rb:2:in `<top (required)>'
    from /usr/local/share/ruby/gems/2.0/gems/bundler-1.13.1/lib/bundler/rubygems_ext.rb:45:in `full_gem_path'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:1393:in `contains_requirable_file?'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:823:in `block in each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:822:in `each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/specification.rb:822:in `each'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:67:in `find'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/bundler-1.13.1/lib/bundler.rb:11:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/jekyll-3.2.1/lib/jekyll/plugin_manager.rb:34:in `require_from_bundler'
    from /usr/local/share/ruby/gems/2.0/gems/jekyll-3.2.1/exe/jekyll:9:in `<top (required)>'
    from /usr/local/bin/jekyll:23:in `load'
    from /usr/local/bin/jekyll:23:in `<main>'

我正在运行Ruby 2.2版。我的服务器是Amazon Linux AMI。如果有任何其他信息需要回答这个问题,请告诉我们!

2 个答案:

答案 0 :(得分:4)

我最终搞清楚了。显然我错过了一个javascript环境。步骤进行:

  1. sudo rm -r Gemfile.lock
  2. nano Gemfile。添加gem 'therubyracer'。保存并退出
  3. bundle install
  4. bundle exec jekyll build
  5. 这解决了我的问题!

答案 1 :(得分:2)

我遇到了同样的问题。当你没有初始化bundler和jekyll依赖时,会发生这种情况。

要解决此问题,

  1. 转到包含jekyll文件的根目录
  2. 运行jekyll new . --force。这将使用bundler和jekyll依赖项初始化当前文件夹
  3. 现在使用bundler exec jekyll serve
  4. 运行服务器 对于新的git存储库,

    jekyll new . --force的工作方式与git init类似。有关详细信息,请参阅documentation