在nokogiri上捆绑安装失败

num*_*s1x 1 ruby nokogiri bundler

我在这个网站后面安装了一些厨师依赖:

https://learnchef.opscode.com/starter-use-cases/multi-node-ec2/

我到了bundle install部分,这是我的Gemfile的样子:

source 'https://rubygems.org'

gem 'berkshelf'
gem 'chef'
gem 'knife-ec2'
Run Code Online (Sandbox Code Playgroud)

当我尝试运行bundle install --path vendor时出现此错误:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

...
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.
Run Code Online (Sandbox Code Playgroud)

我去了nokogiri网站,我能够按照指示成功安装nokgiri 1.6.0与自制软件.9.5:

nokogiri --version
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
# Nokogiri (1.6.0)
Run Code Online (Sandbox Code Playgroud)

当我再次尝试运行bundle install时,我收到相同的消息.我被告知捆绑安装程序并不关心在它之外完成的安装.如何绕过这个并安装这些依赖项?

num*_*s1x 6

经过一番挖掘后,我想通了.这是专门针对OSX Mountain Lion的.

rbenv bundler需要知道使用nokogiri站点给出的这些开关指定的相同路径:

http://nokogiri.org/tutorials/installing_nokogiri.html

这是使用bundler config命令完成的:

bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar    /libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Run Code Online (Sandbox Code Playgroud)

我仍然遇到麻烦,因为配置只是拿起该配置设置的第一行.我不得不编辑$ HOME/.bundle/config并取出一些newlnes才能占用所有的开关.我希望这能节省一些时间.