2014-06-08 107 views
5

我想通過Yosemite上的RVM安裝Ruby on Rails。一切似乎已經奏效,不過,當我嘗試運行「包安裝」我帶有與引入nokogiri的錯誤:在優勝美地上安裝Nokogiri

pauls-air:~ paulmcguane$ 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.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib 
Building native extensions with: '--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.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib' 
This could take a while... 
Building nokogiri using packaged libraries. 
ERROR: Error installing nokogiri: 
    ERROR: Failed to build gem native extension. 

的錯誤信息是:

/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb 
Building nokogiri using packaged libraries. 
----- 
libiconv 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. You may 
need configuration options. 

Provided configuration options: 
     --with-opt-dir 
     --with-opt-include 
     --without-opt-include=${opt-dir}/include 
     --with-opt-lib 
     --without-opt-lib=${opt-dir}/lib 
     --with-make-prog 
     --without-make-prog 
     --srcdir=. 
     --curdir 
     --ruby=/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby 
     --help 
     --clean 
     --use-system-libraries 
     --enable-static 
     --disable-static 
     --with-zlib-dir 
     --without-zlib-dir 
     --with-zlib-include 
     --without-zlib-include=${zlib-dir}/include 
     --with-zlib-lib 
     --without-zlib-lib=${zlib-dir}/lib 
     --enable-cross-build 
     --disable-cross-build 

extconf failed, exit code 1 
+0

你或許應該讓引入nokogiri使用LIB XML其捆綁的版本,而不是強迫使用一個你已經安裝了(雖然它看起來像它可能會這樣做)另外,應該在錯誤消息中提及具有精確編譯錯誤的日誌文件。 –

+1

尚未在優勝美地上安裝。但我會重新開始使用新的gemset,並確保Nokogiri已列入導軌(或任何其他寶石)。這可以確保Nokogiri使用它的嵌入式libxml2(這可以阻止您在第一個孩子時遇到問題)。另見https://github.com/sparklemotion/nokogiri/issues/742#issuecomment-9082139和https://github.com/sparklemotion/nokogiri/issues/829 –

+0

你可以試試這個答案:http:// stackoverflow。 com/questions/24091869 /正在安裝nokogiri-on-osx-10-10-yosemite?answertab = active#tab-top – activars

回答

3

我只是完成了Rails和Ruby的全部安裝以及您需要的一切。我遵循了這些步驟。

https://gorails.com/setup/osx/10.10-yosemite

,並使用以下安裝引入nokogiri

xcode-select --install 
gem install nokogiri 
bundle config build.nokogiri --use-system-libraries 
bundle install 
+2

美麗。只需要第一行'xcode-select --install',然後我就可以'捆綁安裝'而沒有問題。 – colllin

0

我這使用macports而不是自制軟件。我的配置:

  1. 安裝最新的Xcode測試版(Beta 3在寫作時)。從源
  2. xcode-select --switch /Applications/Xcode-Beta3
  3. MacPorts的內置/安裝,每安裝說明here
  4. sudo port install libxml2 libxslt
  5. gem install nokogiri -- --with-iconv-include=/opt/local/include/

有點令人費解,但一切的工作之後的罰款。