嘿我正在尝试在新的ubuntu机器上安装rails。我安装了ruby和rvm但是我收到了“未能构建gem native扩展”的错误。这是什么意思?
$ sudo gem install rails -v 3.2.9
(没有sudo说我没有权限)
然后它会输出很多'抓取'命令并最终输出错误:
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.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
当我输入
$rails server
它表示当前未安装rails
答案 0 :(得分:16)
可能重复:
根据您的ruby版本,运行:
sudo apt-get install ruby1.9.1-dev
答案 1 :(得分:5)
如果您使用的是RVM,则不应使用“sudo”。使用sudo调用libs等rvm路径。试试一下公寓:
gem install rails -v3.2.9
看看是否有帮助。