Heroku uses the wrong rake version (0.9.0 instead of 0.8.7)

I have a Rails 2.3.11 application running on Heroku. However, rake tasks no longer work on Heroku:

rake aborted! You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7. Consider using bundle exec. 

The rake works fine locally. I pointed rake 0.8.7 in my gemfile:

 gem 'rake', '0.8.7' 

My Gemfile.lock file is part of my git repository (not gitignored). I checked that my Gemfile.lock is looking for references to 0.9.0 rake, but could not find.

Heroku seems to be keeping a copy of rake 0.9.0, but I can't find a way to get rid of it. Here's the full trace:

 $ heroku rake -T --trace rake aborted! You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7. Consider using bundle exec. /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:27:in `setup' /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:17:in `setup' /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:100:in `setup' /app/config/../config/preinitializer.rb:16 /app/config/boot.rb:28:in `load' /app/config/boot.rb:28:in `preinitialize' /app/config/boot.rb:10:in `boot!' /app/config/boot.rb:124 /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /app/Rakefile:4 /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:78:in `load_rakefile' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:61:in `run' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:59:in `run' /app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31 /usr/ruby1.8.7/bin/rake:19:in `load' /usr/ruby1.8.7/bin/rake:19 

It looks like the problem described in the question below, but I would prefer not to create a new application like this person:

Gem does not uninstall on Heroku

+4
source share
4 answers

The problem arose from the spork gem in my test group. Heroku tech support was helpful and directed me to the Bundler. I found this Bundler problem on GitHub , which turned out to be not a problem for the Bundler, but actually a problem in spork . For some reason, spork force rake is installed and does not indicate version restrictions, so it just uses the latest version (0.9.0 at the moment).

My solution excluded: and the test groups in Heroku, to prevent spork from being included in my package (spork is used only in the test environment, but I went ahead and excluded: development also, for a good measure):

 $ heroku config:add BUNDLE_WITHOUT="development:test" 

After reinstalling my package on Heroku, my rake tasks work again.

+3
source

Try following Andrei's steps

=== EDIT ===

Too bad this didn't work. I assume that you have only one option left: send a ticket to Heroku staff

0
source

I'm not sure exactly what is inside the hero, but give "heroku bundle exec rake -T -trace", which should download the batch version of the rake.

0
source

I circumvented this by installing an older version of Rake as a gem. So my application uses the version of rake that it can use. In my gemfile:

 gem 'rake', '~> 0.8.7' 
0
source

All Articles