2016-12-19 75 views
3

我不小心刪除了一些庫(我想,不要問怎麼)。現在我無法安裝我需要的nokogiri版本。我已閱讀其他類似問題的帖子,他們的解決方案並沒有幫助。請看下面的錯誤:(捆綁安裝特定的nokogiri -v'1.6.1'問題

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. 

我已經試過釀安裝libxml2的一些配置選項,試圖與庫等安裝在世界那會是什麼?

+0

獲得nokogiri及其依賴工作可能會變得乏味。對於初學者,請告訴我們您的操作系統以幫助您找到庫 – mlabarca

+0

例如,在我的Mac上,使用el Capitan,我必須執行'brew install libxml2 libxslt'來安裝系統庫,然後使用bundler'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' For更多信息看看http://www.nokogiri.org/tutorials/installing_nokogiri.html – mlabarca

回答

0

我重新安裝了裏面裝了不少缺少的庫的RVM

5

試試這個:

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

對,我曾嘗試安裝系統庫...但是,我用我自己的解決方案回答了這個問題。我真的搞砸了我的圖書館......所以沒有使用「系統庫」。我認爲。 :/ –

+0

如果你有答案請分享,這對其他人有幫助 – vipin