2012-07-23 35 views
1

我正在嘗試安裝hpricot,並且出現以下錯誤。我確實安裝了xcode,但我不確定我還缺少了什麼。安裝hpricot

$ gem install hpricot 
Building native extensions. This could take a while... 
ERROR: Error installing hpricot: 
    ERROR: Failed to build gem native extension. 

     /Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for stdio.h... *** 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. 

我也試過nokogiri。

$ gem install nokogiri 
Building native extensions. This could take a while... 
ERROR: Error installing nokogiri: 
    ERROR: Failed to build gem native extension. 

     /Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for libxml/parser.h... *** 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. 

回答

1

我不認爲hpricot支持了。你應該看看nokogiri,它要快得多,而且記錄完備。

編輯:我剛纔檢查的角度來說,Hpricot GitHub的頁面(https://github.com/hpricot/hpricot/),他們也建議你使用引入nokogiri:

Hpricot has ended. Please consider an alternative like nokogiri.

編輯#2:如果你正在運行在安裝它時出錯,很可能是因爲您缺少libxml和其他庫,您需要通過自制軟件或macports進行安裝。所有所需的庫和安裝說明可以在這裏找到:

http://nokogiri.org/tutorials/installing_nokogiri.html

+0

請參閱上面的nokogiri。 – locoboy 2012-07-23 01:44:44

+0

更新了我的回答:) – Sean 2012-07-23 01:51:41

+0

我安裝了nokogiri的東西,但得到相同的答案。 – locoboy 2012-07-23 02:36:19

0

它看起來像你沒有libxml的,或者libxml的開發庫,從引入nokogiri生成的錯誤消息。

0

使用Kubuntu 14.04我首先安裝了ruby-dev,然後安裝了hpricot(錯誤「ERROR:Failed to build gem native extension。」)。