Rails的教程:引入nokogiri-1.5.2错误上捆绑安装(Rails Tutorial: n

2019-07-29 06:41发布

通过第3章的RVM设置,RSpec的和圈部分工作后, Ruby on Rails的教程 ,每当我跑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>'

现在我已经调试了一段时间,我觉得我卡住了。 帮助将不胜感激!

Answer 1:

你需要的头文件编译扩展模块为Ruby。

你可以为你的红宝石版本与正确的版本:

sudo aptitude install ruby-dev



文章来源: Rails Tutorial: nokogiri-1.5.2 error on bundle install