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
You can delete your Gemfile.lock
. Then run bundle install
and bundler will recreate updated Gemfile.lock
with correct rake.
I just did that and this worked for me.
Do as it says. Call rake as
bundle exec rake
Or, alterantively, run bundler like this:
bundle install --binstubs
And then:
bin/rake
This is happening because there're different versions of rake
installed on your system, and it is loading the wrong one by default.
Try running bundle exec rake db:migrate
and see if that works for you.
You seem to have multiple versions of rake
installed. Do gem list
to identify if that is the case.
Depending on that, you may want to uninstall one version using gem uninstall rake
.
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
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:
gem 'rake', "~> 10.2.2"
to
gem 'rake', "~> 11.1.2"
and then run
bundle update rake
I didn't/don't specify gem 'rake'
in my Gemfile, so I simply ran bundle update rake
which correctly updated Gemfile.lock.