user3484648
user3484648

Reputation:

Rails migration error when running migration?

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?

Upvotes: 6

Views: 414

Answers (4)

rmiesen
rmiesen

Reputation: 2559

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.

Upvotes: 0

Jakub Kuchar
Jakub Kuchar

Reputation: 1665

Perhaps:

bundle exec rake db:migrate

Upvotes: 2

neo-code
neo-code

Reputation: 1076

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.

Upvotes: 3

user944938
user944938

Reputation: 1020

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.

Upvotes: 0

Related Questions