heroku - 无法激活测试单元(= 1.2.3,运行时),已激活测试单元-2.3.1。确保将所有依赖项添加到Gemfile

时间:2011-08-10 21:27:07

标签: ruby-on-rails ruby deployment heroku bundle

我一直在heroku上得到这个错误....这是我的宝石文件......我该怎么做

source 'http://rubygems.org'

gem 'rails', '2.3.8'
gem 'will_paginate', '2.3.12'
gem 'googlecharts'
# gem 'faker'
gem 'httparty'
gem 'bandsintown'
gem 'itunes-search-api','0.1.0', :path => 'vendor/gems/itunes-search-api-0.1.0'
gem 'i18n', '0.4.2'
gem "giggly", "~> 0.1.2"
gem "ruby-paypal",'0.0.5', :path => 'vendor/gems/ruby-paypal-0.0.5'

group :production do
  gem 'test-unit', "2.3.1"
  gem 'pg'
end


group :development, :test do
  gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
end

我尝试将其gem 'test-unit', "2.3.1"取出,甚至在没有特定版本的情况下离开它,我收到了此错误...

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
can't activate test-unit (= 1.2.3, runtime), already activated test-unit-2.3.1. Make sure all dependencies are added to Gemfile.
/usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:108:in `block in cripple_rubygems'

现在我收到此错误

/app/lib/tasks/rspec.rake:1:in `<top (required)>'
test-unit is not part of the bundle. Add it to Gemfile.
/usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:102:in `block in cripple_rubygems'
/app/lib/tasks/rspec.rake:1:in `<top (required)>'

我很困惑......下一步该做什么

3 个答案:

答案 0 :(得分:1)

总结一下:

  • 生产中不需要测试单元

  • 删除rspec rake任务,因为您不使用rspec

答案 1 :(得分:1)

对我来说,这个错误:

/app/lib/tasks/rspec.rake:1:in `<top (required)>'
test-unit is not part of the bundle. Add it to Gemfile.
当我去做一个旧项目的维护工作时,

意外启动了。这是由rspec rake任务中的这一行触发的:

gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9

在返回此应用程序时,默认的Ruby版本已升级到1.9。使用RVM将其设置回1.8(在我的情况下,在Jruby下)消除了这条消息并让我像往前一样没有消息。

查尔斯

答案 2 :(得分:0)

如果你的代码在Bundler运行之前加载了一些gems并且加载了与Gemfile和Gemfile.lock中指定的版本不同的版本,则会发生这样的错误。当Bundler稍后运行时,它将检测到已加载错误版本的gem并引发此错误。解决方案是确保Bundler.setup在加载任何其他gem之前运行。有关如何在Bundler网站上的Rails 2.3中执行此操作的说明,您应该遵循:

http://gembundler.com/rails23.html