Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundle exec rake db:migrate causes "can't find executable rake" error

I recently installed Rails 3.1 and now my old Rails 3.0 app won't rake db:migrate. This is what happens when I try to run bundle exec rake db:migrate. I'm on Ubuntu with no RVM

/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:142:in `block in cripple_rubygems': can't find executable rake (Gem::Exception)
    from /usr/local/lib/ruby/gems/1.9.1/bin/rake:19:in `<main>'

When I run just rake db:migrate, it outputs:

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

(See full trace by running task with --trace)

which rake

/usr/local/bin/rake
like image 710
go minimal Avatar asked Nov 18 '11 00:11

go minimal


1 Answers

Put this in your Gemfile:

gem 'rake' , '>= 0.9.2'

and run bundle update


you need to give more details in what environment you're running this:

  • which OS?
  • are you using RVM?
  • is this a brand new RVM setup per chance?

1) Try to run this:

gem list | rake

what output do you get?

2) If you don't see rake in the output, then do this:

gem install rake 

and then try rake db:migrate again

3) If you see rake, but it still doesn't work, then do this:

which rake

what output do you get? it should look something like this:

~/.rvm/gems/ruby-1.9.2-p0/bin/rake
like image 193
Tilo Avatar answered Sep 18 '22 11:09

Tilo