启动中间人服务器时出现Gem :: LoadError

时间:2015-08-29 00:39:11

标签: ruby-on-rails ruby gem rubygems middleman

每当我开始Gem::LoadError时,我都会收到middleman server。显然我的机器无法找到或安装nokogiri。我错过了什么吗?

这是我的错误:

/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'nokogiri' (>= 1.3.3) among 67 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Wilhelm/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1311:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1314:in `block in activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `each'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1300:in `activate_dependencies'
    from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1282:in `activate'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:66:in `gem'
    from /usr/bin/middleman:22:in `<main>'

这是我的红宝石gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23.2
  - RUBY VERSION: 1.9.3 (2014-11-13 patchlevel 551) [x86_64-darwin14.4.0]
  - INSTALLATION DIRECTORY: /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /Users/Wilhelm/.rbenv/versions/1.9.3-dev/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/Wilhelm/.rbenv/versions/1.9.3-dev/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/Wilhelm/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1
     - /Users/Wilhelm/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

1 个答案:

答案 0 :(得分:1)

Could not find 'nokogiri' (>= 1.3.3)

意思是,您的计算机上没有安装nokogiri,但您的其他某些宝石依赖于它。所以,你需要安装它。

如果您使用的是捆绑包,请添加Gemfile

gem 'nokogiri', '1.3.3'

然后,做:

bundle install

安装nokogiri

如果您没有Gemfile,请执行以下操作:

gem install nokogiri -v 1.3.3

有时,安装nokogiri很棘手。理想情况下,我的上述建议应该可以在您的计算机上安装nokogiri。但是,如果您收到任何其他错误,请查看此页面nokogiri installation