为什么不安装 Nokogiri? [英] Why isn't Nokogiri installing?

查看:40
本文介绍了为什么不安装 Nokogiri?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装 Nokogiri 时遇到问题.当我运行 bundle installgem install nokogiri 时,安装失败.

I'm having trouble installing Nokogiri. When I run bundle install or gem install nokogiri the installation fails.

我得到的错误是:(注意:这个失败是因为使用了 nokogiri.org 上的安装命令)

The error I'm getting is: (Note: This failure is from using the installation command on 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 命令由于某种原因不起作用).

I have installed xml2, xslt and libiconv all with brew, and put in their proper versions above. Still no resolution. The only thing I haven't done is libiconv from source (my wget command isn't working for some reason).

推荐答案

您需要指定 nokogiri 来代替使用系统库,因此它不会尝试自己构建它们.

You need to specify nokogiri to use the system libraries instead, so it doesn't try to build them itself.

NOKOGIRI_USE_SYSTEM_LIBRARIES=1 捆绑安装

此处找到答案:在上安装 nokogiri 1.6.0 时出错mac (libxml2).

这篇关于为什么不安装 Nokogiri?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆