Rails:bundler / runtime.rb:在`block in setup'中:您已经激活了activesupport

时间:2016-03-10 19:44:30

标签: ruby-on-rails-4 bundler

捆绑更新(部署应用程序)后,我在底部遇到此问题, 我在部署服务器上使用rbenv和CentOS。

我还有其他项目正在运行whiteout问题。

我试图运行“bundle exec”和“捆绑exec rails s”和“捆绑exec puma”但问题仍然存在。

更新1:“捆绑安装--binstubs”运行正常,但没有解决问题。

更新2:“在您部署的环境中,删除Gemfile.lock文件并执行修复安装的软件包安装”无效。

Uptade 3:儿童问题:Rails: rubygems/dependency.rb:318:in `to_specs': Could not find 'activesupport'

更新4:“您可以尝试更新应用程序用于解决此问题的activesupport版本。”没工作。

更新5:将项目回滚到旧的git hash之后没有发生问题,但最后仍然提交问题。

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables
  git add bin                   # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

  bundle binstubs some-gem-name
  git add bin/new-executable

WARN: Unresolved specs during Gem::Specification.reset:
      json (>= 1.7.7, ~> 1.7)
      minitest (~> 5.1)
      rack (>= 1.0, ~> 1.6)
      loofah (~> 2.0)
      rails-dom-testing (>= 1.0.5, ~> 1.0)
      thor (< 2.0, >= 0.18.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated activesupport 4.2.1, but your Gemfile requires activesupport 4.2.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:19:in `setup'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/setup.rb:8:in `<top (required)>'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in `require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from /var/www/html/zadmin/config/boot.rb:3:in `<top (required)>'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:119:in `require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:119:in `require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:44:in `block in exec_app_rails'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:34:in `loop'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:34:in `exec_app_rails'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/cli.rb:5:in `<top (required)>'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
    from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/bin/rails:9:in `<top (required)>'
    from /home/rails/.rbenv/versions/2.2.1/bin/rails:23:in `load'
    from /home/rails/.rbenv/versions/2.2.1/bin/rails:23:in `<main>'

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以尝试更新应用程序用于解决此问题的activesupport版本。

当您的activesupport指定v4.2.1时,听起来您的系统有Gemfile.lock v4.2.0。要更新activesupport指定的Gemfile.lock版本,请尝试运行以下命令:

bundle update activesupport

此外,您可以尝试通过activesupport删除系统gem uninstall activesupport gem,然后通过bundle install重新安装。