2

I Just moved to site 5 after creating my application offline. I am having problems with rake. When i try to run cd ~/MYAPP/; rake db:migrate --trace RAILS_ENV='production'

I get the following error

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

When i try to unistall rake 0.8.7 I get the following warning.

addressable-2.2.6 depends on [rake (>= 0.7.3)]
    execjs-1.2.6 depends on [rake (>= 0)]
    execjs-1.2.4 depends on [rake (>= 0)]
    friendly_id-3.3.0.1 depends on [rake (~> 0.9.2)]
    launchy-2.0.5 depends on [rake (~> 0.9.2)]
    multi_json-1.0.3 depends on [rake (~> 0.9)]
    orm_adapter-0.0.5 depends on [rake (>= 0.8.7)]
    rack-1.3.2 depends on [rake (>= 0)]
    rack-1.2.3 depends on [rake (>= 0)]
    rack-mount-0.8.3 depends on [rake (>= 0)]
    railties-3.1.0 depends on [rake (>= 0.8.7)]
    railties-3.0.9 depends on [rake (>= 0.8.7)]
    sprockets-2.0.0 depends on [rake (>= 0)]
    therubyracer-0.9.4 depends on [rake (~> 0.9.1)]
    thor-0.14.6 depends on [rake (>= 0.8)]
    treetop-1.4.10 depends on [rake (>= 0)]

I have seen a lot of articles about uninstalling one. When i remove rake 0.9.2 i get an error

no such file to load -- rake/dsl_definition

When already have the following in my rake file.

require 'rake/dsl_definition'
require 'rake'

Has anyone solved this problem, I have tried all too

You have already activated X, but your Gemfile requires Y

Community
  • 1
  • 1
Benjamin
  • 2,108
  • 2
  • 26
  • 46

1 Answers1

8

Try to run this command:

bundle exec rake db:migrate --trace RAILS_ENV=production

In this way you should launch your command with the pack of gem bundled with your app.

Matteo Alessani
  • 10,264
  • 4
  • 40
  • 57
  • I have tried this and i get WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead. at /home/mysite/stage/vendor/bundle/ruby/1.8/gems/sunspot_rails-1.2.1/lib/sunspot/rails/tasks.rb:41 ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! production database is not configured – Benjamin Sep 28 '11 at 07:47
  • Do you have database.yml in prodution? is it configured? – Matteo Alessani Sep 28 '11 at 08:08
  • This what i have in my 'production: adapter: mysql2 encoding: utf8 reconnect: true database: dbformysite_ pool: 5 username: dbusername password: mypassword socket: /tmp/mysql.sock' so i guess the answer is yes. – Benjamin Sep 28 '11 at 08:25
  • Works well in production but when i loaded it to Site5 hosting i can't migrate my db. – Benjamin Sep 28 '11 at 08:42
  • Tried that too, when i do that i get 'You have requested: rake = 0.8.7 The bundle currently has rake locked at 0.9.2. Try running `bundle update rake` ' Then when i run bundle update rake , Updating .gem files in vendor/cache * rake-0.8.7.gem Removing outdated .gem files from vendor/cache * rake-0.9.2.gem Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed. I then run bundle exec rake db:migrate --trace RAILS_ENV='production' i get no such file to load -- rake/dsl_definition. I actually have require 'rake/dsl_definition' require 'rake' – Benjamin Sep 28 '11 at 08:58
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/3847/discussion-between-vezu-and-matteo-alessani) – Benjamin Sep 28 '11 at 08:58