Can not downgrade bundler for heroku - ruby-on-rails

I am trying to push my project to heroku and I am getting this error.
Your Ruby version is 2.3.0, but your Gemfile specified 2.3.0
remote: Bundler Output: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
I am also using rvm.
It seems like the heroku bundler uses 1.11.2 so I am trying to downgrade my version from 1.12.5.
I did gem uninstall bundler then gem install bundler --version '1.11.2'
However when I do bundler -v, it's still showing 1.12.5
But when I do gem uninstall bundler, it shows
Successfully uninstalled bundler-1.11.2
I still can't push and I am getting that error. Please help.

Please follow these steps;
http://rubygems.rubyforge.org/rubygems-update/UPGRADING_rdoc.html
And one more thing I think your bundler is installed in the rvm default gemset i.e. system gemset.
Try checking this;
Do rvm list in terminal, this will give you output like this;
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
=* ruby-2.1.4 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]
Now do rvm gemset list; this will give you out put as this;
(default)
global
some-gemset
Check which gemset its used in your system, it can be identified as => global whenever you do the rvm gemset list.
Now when you identified in which gemset you currently in, do something like this rvm use 1.9.2#global
Then;
gem uninstall bundler
Or in a single step you can do it like this;
rvm #global do gem uninstall bundler
And then install your desired bundler version like this;
gem install bundler --version '1.11.2'
Hope this might help you.

Related

Why is an old version of Bundler pretending to be a new one?

$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 1.17.3)
capistrano-bundler (2.0.1)
$ ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
$ bundle _1.17.3_ -v
Bundler version 2.1.4
Why does Bundler claim to be 2.1.4, when I don't have that installed?
Is this a way of trying to force me to upgrade by making my Gemfile think I used a newer version, and then making me install that to continue?
Or is there some configuration that I'm overlooking?
UPDATE
gem list bundle -d returns
*** LOCAL GEMS ***
bundler (1.17.3)
Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
Terence Lee, Carl Lerche, Yehuda Katz
Homepage: http://bundler.io
License: MIT
Installed at (default): /Users/brandon/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
The best way to manage your application's dependencies
capistrano-bundler (2.0.1)
Authors: Tom Clements, Lee Hambley, Kir Shatrov
Homepage: https://github.com/capistrano/bundler
License: MIT
Installed at: /Users/brandon/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0
Bundler support for Capistrano 3.x
which bundle returns
/Users/brandon/.rbenv/shims/bundle
Running eval "$(rbenv init -)" does not change anything.
Updating above 2.1.4 doesn't fix the problem either. No matter what I install, I'm told I'm using 2.1.4:
$ gem install --default bundler:2.2.24
Successfully installed bundler-2.2.24 as a default gem
WARNING: Unable to pull data from 'https://gems.github.com/': bad response Not Found 404 (https://gems.github.com/specs.4.8.gz)
1 gem installed
$ bundler --version
Bundler version 2.1.4
You probably have couple versions installed,
try
gem list bundle -d
to see where those are installed
which bundle
to see where 2.1.4 resides
If you are working in a shared environment,
may be the root user would have the bundler which is showing bundle -v as 2.1.4
to find it, you can try digging it in your environment
by env command which will give your environment variables list:
$ env
$ echo $PATH
and your bundler list which you are seeing on gem list bundler would be from your local user space
you can refer these too, which would probably hit the solution
How to `bundle install` when your Gemfile requires an older version of bundler?
How to bundle install gemfile with specific version of bundler

How to find out where ruby version that rails points to is present

I have only ruby-2.3.7 in my machine and the output of the rvm list rubies is
=* ruby-2.3.7 [ x86_64 ]
# => - current
# =* - current && default
# * - default
but when i try to do rails s I get an error saying Your Ruby version is 2.6.4, but your Gemfile specified 2.3.7
I'm not sure how to find out where this particular version of ruby exists in the machine and how to uninstall it or make this error go away.
I cannot change the version of ruby being used in the gemfile though.
Edit.
The output of which ruby is /Users/myname/.rvm/rubies/ruby-2.3.7/bin/ruby
the output of bundle env is
Bundler 1.17.3
Platforms ruby, x86_64-darwin-18
Ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18]
Full Path /Users/bennetsunder/.rvm/rubies/ruby-2.3.7/bin/ruby
Config Dir /Users/bennetsunder/.rvm/rubies/ruby-2.3.7/etc
RubyGems 3.0.6
Gem Home /Users/bennetsunder/.rvm/gems/ruby-2.3.7
Gem Path /Users/bennetsunder/.rvm/gems/ruby-2.3.7:/Users/bennetsunder/.rvm/gems/ruby-2.3.7#global
User Path /Users/bennetsunder/.gem/ruby/2.3.0
Bin Dir /Users/bennetsunder/.rvm/gems/ruby-2.3.7/bin
Tools
Git 2.20.1 (Apple Git-117)
RVM 1.29.8 (latest)
rbenv not installed
chruby not installed
rubygems-bundler (1.4.5)
I realised that I had installed ruby-2.6.4 view brew and it was on the path. To fix this you either do brew uninstall ruby and work with the one installed via rvm or remove the path entry which fetches from brew installation directory.

I'm getting an error when installing Ruby and RVM on the terminal

How do I uninstall the old ruby versions and how do can I update to GemFile to 2.4.2?
Sandys-MacBook-Pro:roughhouse-web sandychow$ bundle install
Your Ruby version is 2.4.2, but your Gemfile specified 2.2.5
Sandys-MacBook-Pro:roughhouse-web sandychow$ rvm list
rvm rubies
ruby-2.1.5 [ missing bin/ruby ]
ruby-2.2.5 [ missing bin/ruby ]
* ruby-2.4.1 [ x86_64 ]
=> ruby-2.4.2 [ x86_64 ]
To specify a Ruby version in your Gemfile, simply include the version towards the top:
For Ruby 2.4.2, you can do this:
# Gemfile
source "https://rubygems.org"
ruby "2.4.2"
# ... your gems on the following lines ...
If you want to uninstall a Ruby version, execute:
$ rvm uninstall <version_number>
So to uninstall version 2.2.5, execute:
$ rvm uninstall 2.2.5
Note: don't include the $ sign. That's just there to represent your terminal window.
More information on specifying Ruby versions in your Gemfile can be found at these links:
Heroku - Ruby versions
Coderwall
If you still experience issues, you may need to install or update bundler:
$ gem install bundler
or
$ gem update bundler
As your Gemfile specified ruby 2.2.5 and your rvm ruby version is 2.4.2, you can simply update the project gems bundle to fix the issue by doing
bundle update
This will update all the gems in your Gemfile file to get compatible with your current ruby version.

Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?

I'm trying to bundle install a ruby project in Git Bash but I'm getting the above message.
ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i836-mingw32]
gem -v
2.3.0
New to Ruby so its really frustrating. I'm trying to do the project below
http://www.viralrails.com/?p=25
This happens because you are specifying a Ruby version in your Gemfile (2.3.0) and this version is not installed or is not the current or default version.
Don't remove the line ruby '2.3.0' as someone said above. You app may have dependencies to this version. Do the following:
1) Check if you have Ruby 2.3.0 installed. If you are using rvm this may be done by
rvm list
and if you are using rbenv by
rbenv versions
2) If you don't have this Ruby version in your list of installed versions, then install it by issuing the following command
rvm install 2.3.0
and if you are using rbenv by
rbenv install 2.3.0
3) If you already had Ruby 2.3.0 installed or completed step 2 above, enter your app directory and issue the following command
rvm use 2.3.0
and if you are using rbenv by
rbenv local 2.3.0
Then run
bundle install
and I believe things will be ok.
Hope it helps!
Install bundler after installing ruby 2.4.0.
gem install bundler
If you installed bundler before installing ruby 2.4.0 then you should reinstall bundler or update it.
Also if the above command didn't work.
gem update bundler

Rails command line not found when installed with RVM

After installing RVM, I have installed Ruby 1.8.7 then Rails 3.
When I do which rails I get /Users/davidbenhamou/.rvm/gems/ruby-1.8.7-p302/bin/rails.
But when I do rails -v I get -bash: /usr/bin/rails: No such file or directory
Why is Rails not working?
Note: I have followed all steps from RVM website and Ruby command line work fine (ruby -v).
To see the rubies you have installed:
rvm list rubies
And you'll see something like this:
ree-1.8.7-2011.03 [ i686 ]
* ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-p0 [ x86_64 ]
=> ruby-1.9.3-p125 [ x86_64 ]
ruby-1.9.3-p125-perf [ x86_64 ]
To use a specific one:
rvm use ruby-1.9.3-p125
then if you do ruby --version, you'll see:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.7.0]
In each of these rubies you need to install all the gems you want to use. The way I do it is actually by using Bundler to install all the gems for a project. But for the simple case here, just do:
rvm all do gem install rails
This will install the rails gem in all your ruby versions. To install to a particular one, use:
rvm ruby-1.9.3-p125 do gem install rails
after you installed RVM and after you set the default Ruby version in RVM, you need to re-install all ruby gems, e.g.
gem install rails
you need to install those gems as the user, not as root.
Because from now on RVM will keep track of all installed gems by the ruby version which was used to install them!

Resources