为什么在Ubuntu中安装JSON gem时出错? [英] Why do I get an error installing the JSON gem in Ubuntu?
本文介绍了为什么在Ubuntu中安装JSON gem时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Ubuntu,当我运行 bundle install
来设置我的Rails环境时,它会在JSON gem安装过程中引发错误:
使用本机扩展安装json(1.7.3)
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require':can not load such file - mkmf(LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require'
from extconf.rb:1:in<<主要>'
Gem文件将保留安装在/home/danny/.bundler/tmp/2040/gems/json-1.7.3中进行检查。
记录到/home/danny/.bundler/tmp/2040/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
的结果安装json时发生错误(1.7 .3)和Bundler无法继续。
确保`gem install json -v'1.7.3'`在绑定之前成功。
当我尝试只安装JSON 1.7.3 gem时,它也给我一个错误:
构建原生扩展。这可能需要一段时间...
错误:安装json时出错:
错误:无法构建gem本机扩展。
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require':can not 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文件将保留安装在/var/lib/gems/1.9.1/gems/json-1.7.3中进行检查。
结果记录到/var/lib/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
我已经安装了RVM并运行Ruby 1.9.3;为什么不能安装JSON gem?
解决方案
安装 ruby1.9.1-dev
sudo apt-get install ruby1.9.1-dev
Using Ubuntu, when I run "bundle install
" to set up my Rails environment, it throws an error during the JSON gem installation:
Installing json (1.7.3) 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/danny/.bundler/tmp/2040/gems/json-1.7.3 for inspection.
Results logged to /home/danny/.bundler/tmp/2040/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
When I try installing only the JSON 1.7.3 gem it also gives me an error:
Building native extensions. This could take a while...
ERROR: Error installing json:
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.7.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
I've installed RVM and am running Ruby 1.9.3; Why can't it install the JSON gem?
解决方案
Installing the ruby1.9.1-dev
package should fix this for you:
sudo apt-get install ruby1.9.1-dev
这篇关于为什么在Ubuntu中安装JSON gem时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文