ruby-on-rails – 无法构建gem native扩展(mkmf(LoadError)) – Ubuntu 12.04 [复制]

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法构建gem native扩展(mkmf(LoadError)) – Ubuntu 12.04 [复制]前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > Unable to install gem – Failed to build gem native extension – cannot load such file — mkmf (LoadError)8个
嘿,我正在尝试在新的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

解决方法

可能重复:

Unable to install gem – Failed to build gem native extension – cannot load such file — mkmf (LoadError)

根据您的ruby版本,运行:

sudo apt-get install ruby1.9.1-dev

猜你在找的Ruby相关文章