Rails 3.2 - “捆绑安装”在重新安装 Ruby 后由于 Gemnasium 错误而失败



我正在开发一个我继承的应用程序,所以有时我会遇到我无法解决的与配置相关的内容。长话短说:我使用 rbenv 在本地计算机上管理 Ruby 版本,最近我试图删除一个我不使用的 Ruby 版本,但不小心删除了我的应用程序中使用的版本(版本为 1.9.3-p392)。

所以我使用 rbenv 重新安装 1.9.3-p392 并在我的应用程序目录中运行bundle install,但出现以下错误:

Could not find gem 'gemnasium (>= 0) ruby' in the gems available on this machine. 

我在运行rails consolerails server时遇到相同的错误。为了解决问题,我运行了gem install gemnasium并得到以下错误:

ERROR:  Could not find a valid gem 'gemnasium' (>= 0) in any repository

。这是有道理的,因为当我去例如 rubygems.org 时,没有"宝石"宝石。所以我不知道为什么gem "gemnasium"一开始就在 Gemfile 中,也不知道它的用途。

为了继续前进并稍后回到问题,我只是在Gemfile中注释掉了gem 'gemnasium'。但是,当我在进入资产预编译部分时尝试部署到使用 Capistrano 进行暂存时,这样做会导致以下问题:

INFO[ce9f38e3] Running bundle exec rake assets:precompile on http01-staging.my_app.com
DEBUG[ce9f38e3] Command: cd /u/apps/my_app/releases/20141126184705 && ( RAILS_ENV=staging bundle exec rake assets:precompile )
DEBUG[ce9f38e3]     rake aborted!
DEBUG[ce9f38e3]     LoadError: cannot load such file -- gemnasium
/u/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/u/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/u/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/u/apps/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/u/apps/my_app/releases/20141126184705/lib/tasks/gemnasium.rake:2:in `block in <top (required)>'
/u/apps/my_app/releases/20141126184705/lib/tasks/gemnasium.rake:1:in `<top (required)>' 

所以。。。基本上我不知道为什么 Gemnasium 会在这里开始,或者如何成功地将其放回我的 Gemfile。任何想法??

看来您的 gemnasium gem 已被弃用(并且未显示在 rubygems.org 中,您应该尝试直接从 github 上的源代码安装它。

将以下行添加到 Gemfile 并运行捆绑包安装

gem 'gemnasium', :git => 'git://github.com/gemnasium/gemnasium-gem.git' 

最新更新