Sashe
Sashe

Reputation: 21

heroku rake:db command error undefined method task' for

I try to heroku run bundle exec rake db:create --trace

and have error

    rake aborted!
    undefined method task' for #<CertApp::Application:0x00000002ad5488>
    /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:215:i
    ninitialize_tasks'
    /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139:i
    n load_tasks'
    /app/vendor/bundle/ruby/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:in
    method_missing'
    /app/Rakefile:8:in <top (required)>'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/rake_module.rb:25:inlo
    ad'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in lo
    ad_rakefile'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:581:inr
    aw_load_rakefile'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:87:in bl
    ock in load_rakefile'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:158:ins
    tandard_exception_handling'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:86:in lo
    ad_rakefile'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:70:inbl
    ock in run'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:158:in s
    tandard_exception_handling'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:68:inru
    n'
    /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/bin/rake:37:in `'

    /app/vendor/bundle/ruby/1.9.1/bin/rake:19:in load'
    /app/vendor/bundle/ruby/1.9.1/bin/rake:19:in'

in gemfile 

gem 'rake', '0.8.7'

What should i do?

Upvotes: 2

Views: 183

Answers (2)

Chiperific
Chiperific

Reputation: 4686

Answer take 2:

I know your gemfile says 0.8.7, but the line /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.2/lib/rake/rake_module.rb:25:inload' is coming from your machine, not Heroku. Meaning you have rake 10.0.2 in there somewhere.

We should be able to avoid using 10.0.2 by running heroku bundle exec rake db:migrate which should force the use of 0.8.7, but I would rather completely uninstall 10.0.2 so you can just run heroku rake db:migrate

So, let's make sure you're using rake 0.8.7 exclusively. Try these things in order:

  1. Delete the rake line from your gemfile. Save it. Close it.
  2. Uninstall rake:gem uninstall rake (or gem uninstall rake -v 10.0.2 if the first one doesn't work)
  3. Run Bundle install & bundle update
  4. Reinstall rake 0.8.7: re-add gem 'rake', '0.8.7' to your gemfile.
  5. run bundle install again
  6. run heroku bundle exec rake db:migrate

And cross your fingers, because I'm pushing the limit of my knowledge on this.

Upvotes: 0

John Beynon
John Beynon

Reputation: 37507

you don't need to create the database on Heroku, it would already exist. They write the database.yml for you as part of the deploy process.

Upvotes: 1

Related Questions