nokogiri will not install - ERROR: Failed to build

2019-01-15 00:35发布

This question already has an answer here:

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条回答
太酷不给撩
2楼-- · 2019-01-15 01:05

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

查看更多
登录 后发表回答