运行捆绑安装时出现 Nokogiri 错误 [英] Nokogiri error when running bundle install
问题描述
试图让克隆的 Rails 应用程序运行.运行 bundle install
时出现此错误:
Trying to get a cloned Rails app running. When running bundle install
I get this error:
Using mini_portile (0.5.0)
Installing nokogiri (1.6.0)
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
但这是 rbenv version
的输出:
› rbenv version
1.9.3-p429 (set by /Users/andrewguo/.rbenv/version)
当运行 gem list
我得到:
.
.
.
mini_portile (0.5.0)
minitest (2.5.1)
multi_json (1.7.7)
nokogiri (1.6.0)
我已经绞尽脑汁想弄清楚可能出了什么问题……请帮忙!
I've been racking my brain for an hour now trying to figure out what can possibly be wrong... Please help!
这是一个更详细的错误输出:
Here's a more verbose error output:
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
Bundler::InstallError: An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:130:in `install_gem_from_spec'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:91:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:90:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `__send__'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19
推荐答案
原来我使用的是默认系统 Ruby(因此在 /Library/Ruby/Gems
中安装了所有的 gem)甚至虽然 rbenv 指向 ruby-1.9.3 所以这就是 Nokogiri 抱怨的原因.
Turned out I was using the default system Ruby (and thus installing all the gems there in /Library/Ruby/Gems
) even though rbenv points to ruby-1.9.3 so that's why Nokogiri was complaining.
通过将其添加到 $PATH 来解决此问题,因此 rbenv 在系统 ruby 之前加载:
Fixed this by adding this to $PATH, so rbenv loads before the system ruby:
export PATH="$HOME/.rbenv/bin:$PATH"
这篇关于运行捆绑安装时出现 Nokogiri 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!