1

I have a Rails 3.0.0 project that was using Ruby 1.9.2. Now that I tried to run it on a new computer with the current rvm, it will say:

$ rails s
/Users/michael/.rvm/gems/ruby-1.9.2-p318@global/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve': Bundler could not find compatible versions for gem "bundler": (Bundler::VersionConflict)
  In Gemfile:
    rails (= 3.0.0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.1.3)

but I already used

gem install rails -v 3.0.0
gem install bundler -v 1.0.0
gem install bundler -v 1.0.2

so that when I gem list, I will see

bundler (1.1.3, 1.0.22, 1.0.0)
rails (3.0.0)

so how come it is still complaining that Rails 3.0.0 requires bundler 1.0.0 and it is not there? How to make the project run again?

Update: my Gemfile is mostly comments except:

source 'http://rubygems.org'

gem 'rails', '3.0.0'      
gem 'sqlite3-ruby', :require => 'sqlite3'

Update 2: if I run bundle check:

$ bundle check
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`

$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 3.0.0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
nonopolarity
  • 146,324
  • 131
  • 460
  • 740

3 Answers3

1

The problem is that you have three version of bundler (1.1.3, 1.0.22, 1.0.0).And your app require only 1.0.0.And when you run server it use 1.1.3.

So first uninstall two bundler by this command

      gem uninstall bundler -v=1.1.3

      gem uninstall bundler -v=1.0.22

Then run server it will sure work....

Kashiftufail
  • 10,815
  • 11
  • 45
  • 79
  • 1
    if I type `gem uninstall bundler -v=1.1.3` it will say `INFO: gem "bundler" is not installed`... and if I create a brand new gemset and gem list, then it will list bundler 1.1.3, but when use the uninstall line, it will also say bundler is not installed – nonopolarity Apr 17 '12 at 11:03
1

You may need to run rails and rake inside the bundler context:

bundle exec rails s

Ditt with your rake commands, e.g.,

bundle exec rake -T

Here's a SO thread with links to more in depth articles. Also, lots of chatter about how to get around it if you get annoyed. Personally, I alias my most common commands anyway, so I don't even notice.

Community
  • 1
  • 1
pduey
  • 3,706
  • 2
  • 23
  • 31
1

Just add Bundler into your gemfile to lock the version of bundler to use for that project.

gem 'bundler', '1.1.0'

If you do this you do not need to uninstall the other versions of Bundler, which you may be using on other projects with different dependencies.

You also shouldn't need to use bundle exec for any rails commands as Rails is bundler aware and will always run in the context of the current bundle. Non Rails commands require `bundle exec'.

nmott
  • 9,454
  • 3
  • 45
  • 34