Using bundle exec may solve this?

13,216

Solution 1

You can run bundle exec rake console which means that the command (in this case rake console) will be locked to the specific gems listed in your Gemfile.

Solution 2

To stop using bundle exec rake you can run bundle clean --force. This command will update your Gemfile.lock.

Solution 3

rubygems-bundler solves this. Run the following commands:

$ gem install rubygems-bundler

$ $ gem regenerate_binstubs

Then try your bundle again.

Share:
13,216
alenm
Author by

alenm

Updated on June 04, 2022

Comments

  • alenm
    alenm almost 2 years

    Here is my Gemfile

    source :rubygems
    
    gem 'rake', '0.9.2.2'
    gem 'sinatra'
    gem 'activerecord', '3.0.9'
    gem 'pg', '~> 0.12.2'
    gem 'logger'
    gem 'nokogiri'
    
    group :development, :test do
      gem 'rack-test'
      gem 'ruby-debug19'
      gem 'sqlite3'
    end
    

    I run rake console which works in other projects and now I get this message:

    You have already activated activesupport 3.1.3, but your Gemfile requires activesupport 3.0.9. Using bundle exec may solve this.

    How do I use `bundle exec to solve this? What does it mean?

  • Steve Jorgensen
    Steve Jorgensen over 12 years
    Note that in some versions of rvm, bundle exec is necessary, and in some, it's automatic. I think that was a convenience that they added for a while, and then took back out because it was causing problems.
  • Sahil Dhankhar
    Sahil Dhankhar almost 10 years
    this worked for me and imo best answer that works without making any changes to your existing Gemfile and Gemfile.lock
  • pronoob
    pronoob over 6 years
    This works! Much better than the bundle exec workaround