Unable to install Nokogiri

2019-07-29 06:54发布

When I run sudo gem install nokogiri on Ubuntu 12.1, I'm returned with this. What's wrong and how do I fix it?

jason@jason:~/ror/clss$ sudo gem install nokogiri
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file 
-- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.5.5 for 
inspection. Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/ext/nokogiri
/gem_make.out

1条回答
你好瞎i
2楼-- · 2019-07-29 07:10

Try to install the "libxslt-dev" and "libxml2-dev" packages:

sudo apt-get install libxslt-dev libxml2-dev

The instructions are on http://nokogiri.org/tutorials/installing_nokogiri.html


Update:

You need sudo aptitude install ruby1.9.1-dev.

Source: "Rails Tutorial: nokogiri-1.5.2 error on bundle install".

查看更多
登录 后发表回答