我需要json ruby gem来测试Rspec中的一些JSON文件。我使用bundler管理我的宝石,我的Gemfile看起来像这样:
source 'https://rubygems.org'
gem 'rake'
gem 'rspec'
gem 'json', '1.8.2'
然而,当我运行bundle install时,一切都会通过json gem。其中我收到以下错误消息:
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 /var/lib/gems/1.9.1/gems/json-1.8.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.2/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that 'gem install json -v '1.8.2'` succeeds before bundling.
我已经四处看了看这个建议:
sudo apt-get install libgmp3-dev
我已经完成了此操作,但错误仍然存在。我尝试安装的宝石版本是1.8.2
,我的ruby版本是ruby 1.9.3p484
,因为这是Ubuntu 14.04的最后一个稳定版本,据我所知
如果有人能帮忙解决这个问题,我将非常感激