加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 为什么不安装Nokogiri?

发布时间:2020-12-17 03:05:35 所属栏目:百科 来源:网络整理
导读:我在安装Nokogiri时遇到了麻烦.当我运行bundle install或gem install nokogiri时,安装失败. 我得到的错误是: (注意:此故障来自使用nokogiri.org上的安装命令) Building native extensions. This could take a while...ERROR: Error installing nokogiri: E
我在安装Nokogiri时遇到了麻烦.当我运行bundle install或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,并在上面添加了正确的版本.仍然没有决议.我唯一没做过的就是来自source的libiconv(我的wget命令由于某种原因不起作用).

解决方法

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

NOKOGIRI_USE_SYSTEM_LIBRARIES = 1个捆绑安装

答案在这里找到:Error installing nokogiri 1.6.0 on mac (libxml2).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读