【问题标题】:bundle install fails on nokogiri在 nokogiri 上捆绑安装失败
【发布时间】:2013-12-21 05:07:08
【问题描述】:

我正在按照这个网站安装一些厨师依赖项:

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

我到了捆绑安装部分,这是我的 Gemfile 的样子:

source 'https://rubygems.org'

gem 'berkshelf'
gem 'chef'
gem 'knife-ec2'

我在尝试运行时收到此错误 捆绑安装 --path 供应商:

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.

我去了 nokogiri 网站,我能够按照指示成功安装 nokgiri 1.6.0 和 homebrew .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)

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

【问题讨论】:

标签: ruby bundler nokogiri


【解决方案1】:

经过一番挖掘,我想通了。这是专门为 OSX Mountain Lion 设计的。

rbenv 捆绑器需要知道使用 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

我仍然遇到了麻烦,因为配置只获取了该配置设置的第一行。我必须编辑 $HOME/.bundle/config 并取出一些新线,然后才能使用所有开关。我希望这会节省一些时间。

【讨论】:

  • 太棒了。从 .bundle/config 中删除新行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-19
  • 1970-01-01
  • 2012-12-16
  • 2018-12-02
相关资源
最近更新 更多