Gem :: LoadError: Rake?

I try to run rake db:migrate locally, but I get the following 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? This has not been the case.

Any idea how to solve this?

Greetings

+4
source share
6 answers

You can remove Gemfile.lock . Then run bundle install , and bundler will update Gemfile.lock with the correct rake.

I just did it and it worked for me.

+13
source

Do as they say. Call rake how

 bundle exec rake 

Or, alternatively, run this package:

 bundle install --binstubs 

And then:

 bin/rake 

This is due to the fact that different versions of rake are installed on your system, and by default it does not load correctly.

+4
source

Try running bundle exec rake db:migrate and see if this works for you.

You seem to have several rake versions installed. Make a gem list to determine if this is the case.

Depending on this, you can uninstall one version using gem uninstall rake .

+1
source

None of them worked for me, but I found a fix. In the application folder that you create (where you find the bin application, etc.) Open "Gemfile.lock", find "rake 10.1.1" (just use search or search), change it to 10.2.2, then save rake. Good luck.

0
source

I think updating all Gemfile.lock is dangerous, especially when you have a lot of gems without specific versions. Sometimes, when you update a pearl, some behavior changes, and it is very difficult to understand why this happened.

I had the same problem for me, and the solution was to modify the Gemfile:

 gem 'rake', "~> 10.2.2" 

to

 gem 'rake', "~> 11.1.2" 

and then run

 bundle update rake 
0
source

I did not specify / did not specify gem 'rake' in my Gemfile, so I just ran bundle update rake , which updated Gemfile.lock correctly.

0
source

All Articles