ruby nokogiri 不会安装 - 错误:无法构建 gem 本机扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16028028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
nokogiri will not install - ERROR: Failed to build gem native extension
提问by Tampa
On a ubuntu 12.04 I get the below.
在 ubuntu 12.04 上,我得到以下信息。
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 的 myh 版本
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.
我正在尝试安装以与厨师刀 ec2 一起使用。
回答by David
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.10Which 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
这应该解决这个问题。或者,请参阅在 Ubuntu 12.10 上安装 Nokogiri (1.5.2) 的问题,这也应该能够回答您的问题。指针以供将来参考。尝试研究可能有答案的 stackoverflow 或其他资源,因为您可能会发现您的问题已经解决了 Wi

