How to downgrade bundler or upgrade rails?

Ruby on-Rails-3GemBundlerOmniauthGem Bundler

Ruby on-Rails-3 Problem Overview


I added omniauth gem to my gemfile and tried to run bundle install, but got a message about incompatibility of rails and bundler versions. I tried to update rails, but got messages about incompatibility with other gems. How can I downgrade bundler to 1.0?

$ bundle install
Fetching gem metadata from http://rubygems.org/......
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.1)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

and

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

  Current Bundler version:
    bundler (1.1.1)

Ruby on-Rails-3 Solutions


Solution 1 - Ruby on-Rails-3

Try the following commands:

gem uninstall bundler
gem install bundler --version '1.0.0'

Solution 2 - Ruby on-Rails-3

To install downgraded version of bundler, try:

gem install bundler --version '<= 0.10.6'

so you could have both version installed (check: gem list bundler/bundler _0.9.26_ -v), then run using that specific version, e.g.:

bundle _0.9.26_ install

Learn more: How to upgrade/downgrade Rubygems at rubyforge

Solution 3 - Ruby on-Rails-3

If you want downgrade or upgrade your bundler There are some problem when we are trying to uninstall global bundler version. I solve this problem of my own technique. Follow the steps:

Step-1: run: gem list bundler

*** LOCAL GEMS ***
bundler (2.0.2, 1.17.3)
bundler-unload (1.0.2)
rubygems-bundler (1.4.4)

I have 2 bundler version here 2.0.2 and 1.17.3. Now I uninstall 2.0.2 because I will use 1.17.3. But when I am trying to uninstall 2.0.2 using this command gem uninstall bundler --version '2.0.2' I find an error:

ERROR:  While executing gem ... (Gem::InstallError)
bundler is not installed in GEM_HOME, try:
    gem uninstall -i /home/habib/.rvm/gems/ruby-2.3.1@global bundler

because It is my global bundler. But Error message have the solution. then I try step 2.

Step-2: run gem uninstall -i /home/habib/.rvm/gems/ruby-2.3.1@global bundler

output: Successfully uninstalled bundler-2.0.2

step-3: I check my bundler list again run gem list bundler

*** LOCAL GEMS ***

bundler (1.17.3)
bundler-unload (1.0.2)
capistrano-bundler (1.2.0)
rubygems-bundler (1.4.4)

Here I have only one bundler 1.17.3 and I can use it my any project

check your bundler version: run bundler -v

output: Bundler version 1.17.3

Solution 4 - Ruby on-Rails-3

To downgrade just type gem uninstall bundler it will display:

Select gem to uninstall:
 1. bundler-1.13.7
 2. bundler-1.14.4
 3. bundler-1.16.4
 4. bundler-2.0.2
 5. All versions

Just select the version you want to uninstall.

Solution 5 - Ruby on-Rails-3

Step 1: install the older version (e.g. 1.17.3) with:

gem install bundler --version '1.17.3'

Step 2: uninstall the newer version with:

gem uninstall bundler

Solution 6 - Ruby on-Rails-3

gem uninstall bundler -v 2.2.0 worked for me

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohnHFView Question on Stackoverflow
Solution 1 - Ruby on-Rails-3bbonaminView Answer on Stackoverflow
Solution 2 - Ruby on-Rails-3kenorbView Answer on Stackoverflow
Solution 3 - Ruby on-Rails-3Mohammad Habibur RahmanView Answer on Stackoverflow
Solution 4 - Ruby on-Rails-3stevo999999View Answer on Stackoverflow
Solution 5 - Ruby on-Rails-3Marco LackovicView Answer on Stackoverflow
Solution 6 - Ruby on-Rails-3cool_phpView Answer on Stackoverflow