Question

When I do rake db:migrate, I get the following error:

rake aborted!
Gem::LoadError: You have already activated rake 10.2.2, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.

How can solve this?

Was it helpful?

Solution

This error is due to the fact that some applications may specify different versions of gems than the ones you have installed.

Try using bundle exec rake db:migrate.

Using bundle exec guarantees that the program is run with the environment specified in the gemfile.

OTHER TIPS

Perhaps:

bundle exec rake db:migrate

There might be other gems in the Gemfile which are dependent on rake 10.2.2, while you are trying to install rake 10.1.0 via your gemfile or explicitly mentioned it. A look into your Gemfile will help.

In case you have specific environment, you may want to run

bundle exec rake db:migrate 

to make sure you are running it appropriately.

As per another answer given on this topic, you can also try deleting the Gemfile.lock file and re-running bundle install to regenerate the Gem dependencies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top