I'm trying to run rake db:migrate
locally but I'm getting the below error:
Gem::LoadError: You have already activated rake 10.2.2, but your Gemfile requires rake 10.1.1. Using bundle exec may solve this.
Not sure why this is happening? It came out of no where.
Any idea how to resolve this?
Cheers
Do as it says. Call rake as
Or, alterantively, run bundler like this:
And then:
This is happening because there're different versions of
rake
installed on your system, and it is loading the wrong one by default.I didn't/don't specify
gem 'rake'
in my Gemfile, so I simply ranbundle update rake
which correctly updated Gemfile.lock.Try running
bundle exec rake db:migrate
and see if that works for you.You seem to have multiple versions of
rake
installed. Dogem list
to identify if that is the case.Depending on that, you may want to uninstall one version using
gem uninstall rake
.You can delete your
Gemfile.lock
. Then runbundle install
and bundler will recreate updatedGemfile.lock
with correct rake.I just did that and this worked for me.
I think that updating all Gemfile.lock is dangerous, especially when you have many gems without a specific versions. Sometimes when you update a gem some behaviour is changed and it is really annoying to find why it happened.
For myself, I had the same problem and the solution was to modify Gemfile:
to
and then run
None of these worked for me but I found a fix. In the application folder you are making (where you find app bin ect..) Open your "Gemfile.lock" find "rake 10.1.1"(just use find or search), change it to 10.2.2, save then rake. Good luck