Bundle exec rake db: migrate raises error "cannot find executable rake"

I recently installed Rails 3.1 and now my old Rails 3.0 application will not be rake db: migrate. This is what happens when I try to run bundle exec rake db:migrate . I'm on Ubuntu without 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 only 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 
+6
source share
1 answer

Put this in your gemfile:

 gem 'rake' , '>= 0.9.2' 

and run bundle update


you need to provide more details about which environment you use this in:

  • which OS?
  • Do you use RVM?
  • Is this a new RVM setup for every chance?

1) Try running this:

 gem list | rake 

what result do you get?

2) If you do not see rake on the output, do the following:

 gem install rake 

and then try rake db:migrate again

3) If you see rake, but it still doesn’t work, do the following:

 which rake 

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

 ~/.rvm/gems/ruby-1.9.2-p0/bin/rake 
+10
source

Source: https://habr.com/ru/post/901768/


All Articles