运行软件包安装时出现Nokogiri错误 [英] Nokogiri error when running bundle install
问题描述
bundle install
时出现此错误: 使用mini_portile(0.5 .0)
安装nokogiri(1.6.0)
Gem :: InstallError:nokogiri需要Ruby版本> = 1.9.2。
安装nokogiri(1.6.0)时发生错误,并且Bundler无法继续。
确保在捆绑之前,gem install nokogiri -v'1.6.0'`成功。
但是这是 rbenv版本的输出
:
> rbenv版本
1.9.3-p429(由/Users/andrewguo/.rbenv/version设置)
当运行 gem list
时,我得到:
。
。
。
mini_portile(0.5.0)
minitest(2.5.1)
multi_json(1.7.7)
nokogiri(1.6.0)
我一直在想我的脑子一个小时,试图找出可能有什么问题......请帮助!
编辑:
以下是一个更详细的错误输出:
安装nokogiri(1.6.0)时发生错误,并且Bundler无法继续。
),尽管rbenv指向ruby-1.9.3,所以这就是Nokogiri抱怨的原因。
确保在捆绑之前,gem install nokogiri -v'1.6.0'`成功。
Bundler :: InstallError:安装nokogiri(1.6.0)时发生错误,并且Bundler无法继续。
确保在捆绑之前,gem install nokogiri -v'1.6.0'`成功。
/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:在`run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:90 :在`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:在`__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:在`start'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:2 0
/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:在`load'
/ usr / bin / bundle中:19
$ c $我发现我使用的是默认的系统Ruby(因此将所有的宝石安装在<$>中)。c $ c> / Library / Ruby / Gems
通过将这个添加到$ PATH中来解决这个问题,所以rbenv在系统ruby之前加载:
export PATH =$ HOME / .rbenv / bin:$ PATH
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.
But this is the output for
rbenv version
:› rbenv version 1.9.3-p429 (set by /Users/andrewguo/.rbenv/version)
When running
gem list
I get:. . . 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!
Edit:
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
解决方案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.Fixed this by adding this to $PATH, so rbenv loads before the system ruby:
export PATH="$HOME/.rbenv/bin:$PATH"
这篇关于运行软件包安装时出现Nokogiri错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!