无法安装Nokogiri

时间:2012-11-21 07:14:53

标签: ruby-on-rails ruby ruby-on-rails-3 gem nokogiri

当我在Ubuntu 12.1上运行sudo gem install nokogiri时,我已经回来了。有什么问题,我该如何解决?

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 个答案:

答案 0 :(得分:3)

尝试安装“libxslt-dev”和“libxml2-dev”软件包:

sudo apt-get install libxslt-dev libxml2-dev

说明在http://nokogiri.org/tutorials/installing_nokogiri.html


更新

您需要sudo aptitude install ruby1.9.1-dev

来源:“Rails Tutorial: nokogiri-1.5.2 error on bundle install”。