I just cleaned rvm and ruby and reinstalled it. I am trying to install rails but I get this error:
我刚刚清理了rvm和ruby并重新安装了它。我正在安装rails,但是我得到了这个错误:
gem install rails -v 3.2.9
gem安装rails - v3.2.9
Building native extensions. This could take a while...
ERROR: Error installing rails:
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.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
And if I run bundle install
with my Gemfile
which has rails 3.2.9
and a few more gems I get this error:
如果我用我的Gemfile来运行包,它有rails 3.2.9和更多的宝石,我就会得到这个错误:
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
Guess what. Running the suggested command gives me another 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.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
2 个解决方案
#1
5
Possible duplicate of:
可能的重复:
- Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
- 无法安装gem -无法构建gem本地扩展-无法加载此类文件- mkmf (LoadError)
- `require': no such file to load -- mkmf (LoadError)
- “require”:没有要加载的此类文件——mkmf (LoadError)
Depending on your ruby version, run:
根据您的ruby版本,运行:
sudo apt-get install ruby1.9.1-dev
#2
1
A simple google search points to this earlier * question:
一个简单的谷歌搜索指向这个早期的*问题:
Why do I get an error installing the JSON gem in Ubuntu?
为什么在Ubuntu中安装JSON gem时会出错?
Installing the ruby1.9.1-dev package should fix this for you:
安装ruby1.9.1-dev包应该可以为您修复这个问题:
sudo apt-get install ruby1.9.1-dev
sudo apt-get安装ruby1.9.1-dev
#1
5
Possible duplicate of:
可能的重复:
- Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
- 无法安装gem -无法构建gem本地扩展-无法加载此类文件- mkmf (LoadError)
- `require': no such file to load -- mkmf (LoadError)
- “require”:没有要加载的此类文件——mkmf (LoadError)
Depending on your ruby version, run:
根据您的ruby版本,运行:
sudo apt-get install ruby1.9.1-dev
#2
1
A simple google search points to this earlier * question:
一个简单的谷歌搜索指向这个早期的*问题:
Why do I get an error installing the JSON gem in Ubuntu?
为什么在Ubuntu中安装JSON gem时会出错?
Installing the ruby1.9.1-dev package should fix this for you:
安装ruby1.9.1-dev包应该可以为您修复这个问题:
sudo apt-get install ruby1.9.1-dev
sudo apt-get安装ruby1.9.1-dev