简体   繁体   English

Ruby on Rails-捆绑软件安装期间出错

[英]Ruby on rails - Error during bundle install

I've been googling this error below, but I can't solve this error: 我一直在下面搜索该错误,但无法解决此错误:

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'

So I googled this error: 所以我用谷歌搜索了这个错误:

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h mkmf.rb在/usr/lib/ruby/include/ruby.h找不到ruby的头文件

and I got some similar questions like this one: Error while installing json gem 'mkmf.rb can't find header files for ruby' 我也遇到类似的问题: 安装json gem'mkmf.rb时找不到ruby的头文件'

But I already installed ruby-dev: 但是我已经安装了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.

I'm really struggling to solve this problem (even though it seems to be a simple one). 我真的很难解决这个问题(即使它看起来很简单)。

尝试为您的Ruby版本2.1安装ruby-dev库。

$ sudo apt-get install ruby2.1-dev

Had similar error on fedora when trying to install compass for SASS development 尝试安装指南针进行SASS开发时,在fedora上发生了类似的错误

gem install compass

failed with 失败了

Building native extensions. 构建本机扩展。 This could take a while... ERROR: Error installing compass: ERROR: Failed to build gem native extension. 这可能需要一些时间...错误:安装罗盘时出错:错误:无法生成gem本机扩展名。

/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h / usr / bin / ruby​​ extconf.rb mkmf.rb在/usr/share/include/ruby.h找不到ruby的头文件

Ran this 跑这个

yum -y install gcc ruby-devel rubygems 

and then was able to run the install again successfully. 然后能够再次成功运行安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM