nokogiri will not install - ERROR: Failed to build gem native extension [duplicate]

我是研究僧i 提交于 2019-11-26 16:54:07

问题


On a ubuntu 12.04 I get the below.

sudo apt-get install libxml2 libxml2-dev libxslt libxslt-dev
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.9 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.5.9/ext/nokogiri/gem_make.out

Here is myh version of ruby

ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

I am trying to install for use with knife-ec2 for chef.


回答1:


You should have the necessary required packages:

Ruby

sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby

nokogiri

sudo apt-get install libxslt-dev libxml2-dev zlib1g-dev
sudo gem install nokogiri

This should fix this. Or alternatively see Problems installing Nokogiri (1.5.2) on Ubuntu 12.10 Which should also be able to answer your question. Pointer for future reference. Try to research on stackoverflow or other resources that may have the answer because you may find that your problem has already been solved Wi



来源:https://stackoverflow.com/questions/16028028/nokogiri-will-not-install-error-failed-to-build-gem-native-extension

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!