为什么在 Ubuntu 中安装 JSON gem 时出现错误? [英] Why do I get an error installing the JSON gem in Ubuntu?

查看:31
本文介绍了为什么在 Ubuntu 中安装 JSON gem 时出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Ubuntu,当我运行bundle install"来设置我的 Rails 环境时,它在 JSON gem 安装过程中抛出一个错误:

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.

当我尝试只安装 JSON 1.7.3 gem 时,它也会给我一个错误:

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

我已经安装了 RVM 并且正在运行 Ruby 1.9.3;为什么不能安装 JSON gem?

I've installed RVM and am running Ruby 1.9.3; Why can't it install the JSON gem?

推荐答案

安装 ruby1.9.1-dev 包应该可以解决这个问题:

Installing the ruby1.9.1-dev package should fix this for you:

sudo apt-get install ruby1.9.1-dev

这篇关于为什么在 Ubuntu 中安装 JSON gem 时出现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆