我在安装 Nokogiri 时遇到问题。当我跑步时bundle install
or gem install nokogiri
安装失败。
我收到的错误是:
(注:此失败是由于使用nokogiri.org上的安装命令造成的)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/roneesh/.rbenv/versions/1.9.3-p194/bin/ruby extconf.rb --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28/ --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib
Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
我尝试使用的命令是:
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28/ --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib
我已经用brew安装了xml2、xslt和libiconv,并在上面放入了它们正确的版本。仍然没有解决。我唯一没有做的就是从源代码中获取 libiconv(我的 wget 命令由于某种原因无法工作)。
您需要指定 nokogiri 来使用系统库,因此它不会尝试自行构建它们。
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install
在这里找到答案:在 Mac 上安装 nokogiri 1.6.0 时出错 (libxml2) https://stackoverflow.com/questions/17863477/error-installing-nokogiri-1-6-0-on-mac-libxml2.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)