【问题标题】:Bundle install specific nokogiri -v '1.6.1' issues捆绑安装特定 nokogiri -v '1.6.1' 问题
【发布时间】:2017-05-05 02:32:45
【问题描述】:

我不小心删除了一些库(我想,不要问如何)。现在我无法安装我需要的 nokogiri 版本。我已经阅读了其他类似问题的帖子,他们的解决方案没有帮助。请看以下错误:(

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /private/var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/gems/nokogiri-1.6.1/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20161219-83285-voqu1e.rb extconf.rb --use-system-libraries
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin16.3.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /private/var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin16.3.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin16.3.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /private/var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin16.3.0/libxslt/1.1.26)...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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.  

然后是一些配置选项

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/extensions/universal-darwin-16/2.0.0/nokogiri-1.6.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/gems/nokogiri-1.6.1 for inspection.
Results logged to /var/folders/_w/_81xdz4n1x5_9kd3xxtqlv3w0000gn/T/bundler20161219-83285-1fnegt2nokogiri-1.6.1/extensions/universal-darwin-16/2.0.0/nokogiri-1.6.1/gem_make.out

An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.

我尝试过 brew 安装 libxml2,尝试安装库等。这到底是什么??

【问题讨论】:

  • 让 nokogiri 及其依赖项工作可能会变得乏味。对于初学者,请告诉我们您的操作系统以帮助您找到库
  • 例如,在我的带有 el Capitan 的 Mac 中,我必须使用 brew install libxml2 libxslt 来安装系统库,然后使用捆绑程序 bundle config build.nokogiri --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 了解更多信息,请查看 nokogiri.org/tutorials/installing_nokogiri.html

标签: ruby-on-rails ruby rubygems nokogiri


【解决方案1】:

我重新安装了 RVM,它安装了很多缺少的库。

【讨论】:

    【解决方案2】:

    试试这个:

    gem install nokogiri -v 1.6.2.1 -- --use-system-libraries
    

    【讨论】:

    • 对,我曾尝试使用系统库安装...但是,我用自己的解决方案回答了这个问题。我真的只是搞砸了我的库......所以没有“系统库”可以使用。我想。 ://
    • 如果你有答案,请分享,这将有助于其他人
    猜你喜欢
    • 2015-11-13
    • 1970-01-01
    • 2012-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-21
    • 2012-09-11
    相关资源
    最近更新 更多