Run time error with multiple version of gems installed

Hi all,

I have installed two versions of rake for different projects.

Due to this i am getting the following error

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

Can any one help me , how to solve this without changing Gemfile/bundle exec ?

FYI : I have two versions of gems

rake (0.9.6, 0.9.2.2)
Author: Jim W.
Rubyforge: http://rubyforge.org/projects/rake
Homepage: http://rake.rubyforge.org
Installed at (0.9.6): /usr/local/rvm/gems/ruby-1.9.3-p286
(0.9.2.2): /usr/local/rvm/gems/ruby-1.9.3-p286@global

Ruby based make-like utility.

Thanks in advance …

I’d have to see some of your code, but you probably have to add gem 'rake', '0.9.2.2' before require 'rake' somewhere. Otherwise Rubygems
will assume you want the newest version available.

Add:
gem ‘rake’, ‘0.9.2.2’

to your Gemfile, and rerun ‘bundle install’

Then when you run:

 bundle exec rake <some_rake_command_here>

it will use the version specified in the Gemfile, as well as lock you to
that version
in the Gemfile.lock file.

Also, if you are creating a gem, you can:

 gem.add_dependency "rake", "0.9.2.2"

in your .gemspec file and ensure that the last line in your
Gemfile says

 gemspec

which will then record the dependency, and enforce the version which
will automate
installing that version of rake when your gem is installed.

That last bit is only if you’re making a gem. It has no application to
a regular project.

Hi all,
Can any one help me , how to solve this without changing Gemfile/`bundle
Installed at (0.9.6): /usr/local/rvm/gems/ruby-1.9.3-p286
(0.9.2.2): /usr/local/rvm/gems/ruby-1.9.3-p286@global

Ruby based make-like utility.

Thanks in advance …


D. Deryl D.

“The bug which you would fright me with I seek” - William Shakespeare -
The Winter’s Tale, Act III, Scene II - A court of Justice.

On Wed, Jan 2, 2013 at 1:52 AM, Mallikarjuna Y.
[email protected] wrote:

I have installed two versions of rake for different projects.

Due to this i am getting the following error

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

Look into rvm or rbenv. These can be used to manage gemsets so you
can switch between them for different projects. Also, when you start
your projects (there’s probably a way to retrofit but I’m too lazy,
er, I mean, busy to go figure it out), do rails new your_project_name
–skip-bundle, followed by bundle install --path vendor --binstubs.
That will put the gems for this project in the vendor dir under the
project, making a neatly self-contained unit. (The downside is
possible duplication, soaking up more disk space than reusing the same
copy of gems.)

-Dave