无法安装 rails 3.2.9:无法构建 gem 本机扩展



我刚刚清理了 rvm 和 ruby 并重新安装了它。我正在尝试安装导轨,但出现此错误:

宝石安装导轨 -v 3.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

如果我用rails 3.2.9和更多宝石的Gemfile运行bundle install,我会收到此错误:

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.

你猜怎么着。运行建议的命令会给我另一个错误:

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

可能的重复项:

  • 无法安装 gem - 无法构建 gem 本机扩展 - 无法加载此类文件 -- mkmf (加载错误)
  • '
  • require':没有要加载的此类文件 -- mkmf (LoadError)

根据您的红宝石版本,运行:

sudo apt-get install ruby1.9.1-dev

一个简单的谷歌搜索指向了这个早期的stackoverflow问题:

为什么我在 Ubuntu 中安装 JSON gem 时出错?

安装 ruby1.9.1-dev 软件包应该可以为您解决此问题:

sudo apt-get install ruby1.9.1-dev

相关内容

  • 没有找到相关文章

最新更新