我不小心删了一些图书馆(我想,不要问怎么样)。现在我无法安装我需要的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,尝试安装库等等。这可能是什么?
答案 0 :(得分:5)
试试这个:
gem install nokogiri -v 1.6.2.1 -- --use-system-libraries
答案 1 :(得分:0)
我重新安装了RVM,它安装了许多缺少的库。