无法启动rails app:错误:无法构建gem原生扩展。僵局;递归锁定

时间:2016-04-12 07:52:52

标签: ruby-on-rails ubuntu-14.04 virtualbox

我试图在VirtualBox Ubuntu 14.04上启动我的rails应用程序,但出于某种原因,每次我使用任何rails或gem命令(如rails sbundle install时,我都会收到以下错误消息:

/home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:159:in `synchronize': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)

    ERROR: Failed to build gem native extension.

    deadlock; recursive locking

Gem files will remain installed in /home/jakup/.rvm/gems/ruby-2.2.4@global/gems/gem-wrappers-1.2.7 for inspection.
Results logged to /home/jakup/.rvm/gems/ruby-2.2.4@global/extensions/x86_64-linux/2.2.0-static/gem-wrappers-1.2.7/gem_make.out


Gem files will remain installed in /home/jakup/.rvm/gems/ruby-2.2.4/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /home/jakup/.rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/gem_make.out
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:159:in `build_extension'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:195:in `each'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1434:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:924:in `each'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:924:in `find'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:924:in `find_inactive_by_path'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:185:in `try_activate'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /home/jakup/.rvm/gems/ruby-2.2.4/gems/psych-2.0.17/lib/psych.rb:6:in `<top (required)>'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:601:in `load_yaml'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/config_file.rb:327:in `load_file'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/config_file.rb:196:in `initialize'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:289:in `new'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems.rb:289:in `configuration'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:63:in `run'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/ext_conf_builder.rb:37:in `block in build'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tempfile.rb:319:in `open'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:160:in `chdir'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:160:in `block in build_extension'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:159:in `synchronize'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:159:in `build_extension'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:195:in `each'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1434:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:68:in `block in require'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `each'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `find'
    from /home/jakup/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /home/jakup/.rvm/gems/ruby-2.2.4/gems/railties-4.2.6/bin/rails:9:in `<top (required)>'
    from /home/jakup/.rbenv/versions/2.2.3/bin/rails:23:in `load'
    from /home/jakup/.rbenv/versions/2.2.3/bin/rails:23:in `<main>'

过去我在VirtualBox上将网络适配器设置为桥接网络时曾经出现此错误,但现在即使我没有在桥接网络上发生此错误,也有任何想法?

2 个答案:

答案 0 :(得分:0)

我会写一个答案的形式,只是为了更容易写。

您要删除所有以前安装的宝石(例如手动删除宝石)并尝试重新安装它们。它应该工作。

不要删除这些(忽略宝石的版本):

rake (10.4.2)
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
gem-wrappers (1.2.7)
bundler (1.11.2)
bundler-unload (1.0.2)

此外,尝试在.bundle目录中安装不在全局命名空间中的gem。首先安装它,如bundle install --path .bundle,我想每次下次它将使用该目录

答案 1 :(得分:0)

我找到了一个(临时?)解决方案..

当我在本地运行项目时出于某种原因,我在Windows(主机)和ubuntu(虚拟机中的guest)之间的共享文件夹中运行项目,因此不在共享文件夹中,我卸载文件夹,它可以工作。 / p>

不要问我为什么有效的细节,它只是出于某种原因神奇地做了。