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
Difference Between "And" and && in Ruby
Difference Between Require_Relative and Require in Ruby
Getting Output of System() Calls in Ruby
The Authorization Mechanism You Have Provided Is Not Supported. Please Use Aws4-Hmac-Sha256
Class ≪≪ Self Idiom in Ruby
Ruby, Difference Between Exec, System and %X() or Backticks
How to Change Default Timezone For Active Record in Rails
Can't Install Ruby Under Lion With Rvm - Gcc Issues
Difference Between Attr_Accessor and Attr_Accessible
How to Prevent Browser Page Caching in Rails
How to Avoid Nomethoderror For Missing Elements in Nested Hashes, Without Repeated Nil Checks
How to Sort an Array in Descending Order in Ruby
Understanding the Rails Authenticity Token
How to Understand Nil Vs. Empty Vs. Blank in Ruby
Restarting a Loop from the Top
Git, Heroku: Pre-Receive Hook Declined
How to Have Ruby Logger Log Output to Stdout as Well as File