Search code examples
ruby-on-railsrubyrake

Must prepend bundle exec to rake db:migrate


I don't know what's going on but when I created a new model and want to run rake db:migrate but it gives me this error:

rake aborted! Gem::LoadError: You have already activated rake 11.0.1, but your Gemfile requires rake 10.5.0. Prepending bundle exec to your command may solve this.

I believe I didn't do any updates with the gem. I tells me to prepend bundle exec before executing the rake but I just want to run rake db:migrate as I did before.

How to make my local system rake gem version to fit in with my rails rake gem version?


Solution

  • You can fix this rake version conflict by following these steps.

    1. Uninstall rake by using the command gem uninstall rake

    2. Install the specific rake version by using the command gem install rake --version 10.5.0

    You can also update the rake version in your Gemfile to 11.0.1

    Also, if you use rvm, make sure the rake version does not change when the gemsets are switched as you use different ruby versions.