6

嘿,我是 Rails(以及 linux)的新手,我不断收到此错误:

Installing json (1.7.5) with native extensions 
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:1:in `<main>'


Gem files will remain installed in /home/jack/.bundler/tmp/10426/gems/json-1.7.5 for inspection.
Results logged to /home/jack/.bundler/tmp/10426/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.5'` succeeds before bundling.
jack@jack-ThinkCentre:~/rails_projects/sample_app$ 

我无法单独安装 gem 或使用捆绑安装。我使用 rvm 安装导轨。提前致谢。

4

2 回答 2

10

安装 ruby​​1.9.1-dev 包应该可以为你解决这个问题

sudo apt-get install ruby1.9.1-dev
于 2012-12-01T05:33:25.403 回答
2

“在运行 ruby​​ 2.2.3 的 ubuntu-trusty-64 上存在同样的问题。解决方案是安装 libgmp3-dev。”

sudo apt-get install libgmp3-dev
于 2015-11-11T21:51:36.980 回答