Rails教程:nokogiri-1.5.2在捆绑安装时出现错误[英] Rails Tutorial: nokogiri-1.5.2 error on bundle install

本文是小编为大家收集整理的关于Rails教程:nokogiri-1.5.2在捆绑安装时出现错误的处理方法,想解了Rails教程:nokogiri-1.5.2在捆绑安装时出现错误的问题怎么解决?Rails教程:nokogiri-1.5.2在捆绑安装时出现错误问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

在完成 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>'

我已经调试了一段时间,我想我被卡住了.非常感谢您的帮助!

推荐答案

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

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

sudo aptitude install ruby-dev

本文地址:https://www.itbaoku.cn/post/786430.html