30

在完成Ruby on Rails 教程第 3 章的 RVM 设置、rspec 和保护部分之后,每当我运行时,bundle install我都会收到以下错误转储:

Gem::Installer::ExtensionBuildError: 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 /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2 for inspection.
Results logged to /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling.

在 gem_make.out 中:

Gem::Installer::ExtensionBuildError: 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>'

我已经调试了一段时间,我想我被卡住了。帮助将不胜感激!

4

1 回答 1

79

您需要用于为 Ruby 编译扩展模块的头文件。

您可以通过以下方式获得适合您的 ruby​​ 版本的正确版本:

sudo aptitude install ruby-dev

于 2012-05-05T23:39:03.640 回答