You have already activated X, but your Gemfile requires Y

Viewed 88145

When running rake I get this error:

You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

Using bundle exec rake instead of just rake seems to work, but is it the best way to fix this?

10 Answers

Try bundle clean --force

It removes every system gem not in this bundle

Just used: bundle update

In my case, it solved my dependency version problem with Gemfile.lock file, it updated the packages with the latest version.

You might as well want to delete the Gemfile.lock file and run bundle install or just bundle, then try again.

This happens when there are different version in Gemfile and Gemfile.lock, in mycase am having strscan (3.0.3) in Gemfile.lock and ruby 3.0.4 in Gemfile, just delete the Gemfile.lock and run bundle install or bundle update

Another way to not type it every time is with a Makefile, for example

rake :
    bundle exec rake
Related