You Have Already Activated X, But Your Gemfile Requires Y

You have already activated X, but your Gemfile requires Y

Using bundle exec is the right way to do this.

Basically what's happening is that you've updated rake to 0.9.2 which now conflicts with the version specified in your Gemfile. Previously the latest version of rake you had matched the version in your Gemfile, so you didn't get any warning when simply using rake.

Yehuda Katz (one of the original Bundler developers) explains it all in this blog post.

To avoid typing bundle exec ... all the time, you could set up an alias or function in your shell for commands you commonly use with Bundler. For example this is what I use for Rake:

$ type bake
bake is a function
bake ()
{
bundle exec rake "$@"
}

bundle exec - You have already activated json X, but your Gemfile requires json Y

A bit late to the game, but hey, I have a solution! this is how I did it: so besides looking in your standard place where gems are installed, there is one other place where gems can apparently be "defined", and brought into the system. I install stuff using rbenv (I recommend this over RVM), and these are the directories for me:

/home/jf/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems
/home/jf/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/specifications/default

In your case, your exact location/s might be different, but you should be able to figure it out. If a gem is in the standard place (/home/jf/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems), you would be able to 'gem uninstall' without a problem. For the other location, though... tough. To simply prevent the system version from being recognized so that you can use the version from the Gemfile, simply move the json-X.gemspec file away from that second directory (/home/jf/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/specifications/default above) somewhere else. And that's it!

Ruby on Rails Error - already activated xxxxx, but your Gemfile requires yyyyy

Try running bundle install or bundle update... it sounds like your Gemfile has conflicting information than what your actual environment has.

If that doesn't help, use bundle exec <actual command here>.

You have already activated rake 0.9.6, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this

At the root of project, do:

gem list rake 

You will see probably more than one version. If so, then remove the version you don't need (i.e. 0.9.6) by command:

gem uninstall rake

it will ask which version to remove. Or try doing

bundle update rake

You have already activated rspec-support 3.0.0.beta1, but your Gemfile requires rspec-support 3.0.0.beta1

Try the complete command

bundle exec rspec spec/

In case this one do not work, try deleting the Gemfile.lock file and bundle install from scratch. Then retry.



Related Topics



Leave a reply



Submit