質問

RVM Ruby 1.9.1の下にNokogiri Gemの設置に問題がある。

gem install nokogiri

私は取得しています...

/usr/include/libxml2... no
libxml2 is missing.  try 'port install libxml2' or 'yum install libxml2-devel'
*** extconf.rb failed ***

しかし、私はチェックしました:

sudo apt-get install libxml2

そして、私は得ました:

Reading state information... Done
libxml2 is already the newest version.

これはおそらく根源ですか? RVMはユーザースペースですべてを実行します。

役に立ちましたか?

解決

You might want to confirm that the version of libxml installed by apt is current. Nokogiri likes nice fresh versions of libxml, so I built my libxml install from source.

nokogiri -v will tell you what you're using.

他のヒント

A simpler solution:

sudo apt-get install libxslt-dev libxml2-dev

I ran into a similar problem using homebrew on Mac.

Here's the code that does the trick, a small extension of the Nokogiri installation instructions for homebrew. Basically, you need to include a directive to tell nokogiri to use the homebrew libxml dirs. Make sure you point to the correct version of libxml2 installed by homebrew, which for me was 2.7.8:

brew install libxml2

brew link libxml2 #this may be enough but didn't work for me with rvm

#explicitly tell nokogiri to use you homebrew libxml2 rather than system
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top