微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Ruby on rails – 软件包安装过程中出错

我以前一直在google这个错误,但我无法解决这个错误
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.1 extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf Failed,exit code 1

Gem files will remain installed in /home/dyego/.bundler/tmp/9200/gems/sqlite3-1.3.9 for inspection.
Results logged to /home/dyego/.bundler/tmp/9200/extensions/x86_64-linux/2.1.0/sqlite3-1.3.9/gem_make.out
An error occurred while installing sqlite3 (1.3.9),and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
         run  bundle exec spring binstub --all
/usr/lib/ruby/vendor_ruby/bundler/resolver.rb:296:in `resolve': Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:168:in `start'
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:129:in `block in resolve'
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:128:in `catch'
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:128:in `resolve'
    from /usr/lib/ruby/vendor_ruby/bundler/deFinition.rb:179:in `resolve'
    from /usr/lib/ruby/vendor_ruby/bundler/deFinition.rb:114:in `specs'
    from /usr/lib/ruby/vendor_ruby/bundler/deFinition.rb:159:in `specs_for'
    from /usr/lib/ruby/vendor_ruby/bundler/deFinition.rb:148:in `requested_specs'
    from /usr/lib/ruby/vendor_ruby/bundler/environment.rb:18:in `requested_specs'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:13:in `setup'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:120:in `setup'
    from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:17:in `<top (required)>'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

所以我googled这个错误

mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h

我也有类似的问题:
Error while installing json gem ‘mkmf.rb can’t find header files for ruby’

但是我已经安装了ruby-dev:

sudo apt-get install ruby-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ruby-dev is already the newest version.
0 upgraded,0 newly installed,0 to remove and 72 not upgraded.

我真的很努力地解决这个问题(即使它似乎是一个简单的).

解决方法

尝试为您的Ruby版本2.1安装ruby-dev库
$sudo apt-get install ruby2.1-dev

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐