I am getting this error while trying to push my app to heroku:
Warning: the running version of Bundler (1.17.2) is older than the version that created the lockfile (1.17.3). We suggest you upgrade to the latest version of Bundler by runninggem install bundler. I have the following versions of bundler:
gem list | grep bundler
bundler (2.0.2, default: 1.17.3, 1.17.2)
I have tried various suggestions from different similar posts but I am not able to set the bundler version to 1.17.2 which is required by Heroku. I tried:
gem uninstall bundler
gem install bundler -v 1.17.2
1 gem installed
Then removed the lock file and rerunning the bundle update but the version 1.17.3 still comes as the default.
I tried gem uninstall bundler:1.17.3 which returned:
Successfully uninstalled bundler-1.17.3
Then: gem install bundler -v 1.17.2which returned:
Successfully installed bundler-1.17.2
1 gem installed
Now bundler -v returns a LoadError:
Traceback (most recent call last):
3: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `<main>'
2: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `eval'
1: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `<main>'
/home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `load': cannot load such file -- /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundler (LoadError)
I am using rvm and I also tried to uninstall in the global gem set:
rvm use 2.6.1#global
gem uninstall bundler:1.17.3 which does not return any output or message.
How can I set the bundler to 1.17.2?
set your bundler version as a default version like below if you want to use 2.0.2
bundle _2.0.2_ -v
I had troubles with bundlers recently (Bundler v2.0.2 was installed, v1.17.3 set as default) but with a different error (Can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)).
Running gem update --system did a trick for me.
Install the correct bundler for your application with the following command:
gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
Related
I kinda messed up when trying to solve a problem.
I was looking up some solutions to solve this problem
cap staging deploy
rbenv: cap: command not found
The `cap' command exists in these Ruby versions:
3.0.0
One solution I came across has something to do with gem install bundler
To check my gem bundler, I ran gem list bundler which listed nothing so I ran gem install bundler which installed bundler (2.2.23).
However, when I ran bundle install, I get this:
Traceback (most recent call last):
2: from /Users/kiki/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
1: from /Users/kiki/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/kiki/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
So I wanted to uninstall/undo the steps I took. However, typing in gem uninstall bundler and gem uninstall bundler -v 2.2.23 didn't work! It kept returning Gem 'bundler' is not installed and in fresh terminal, when I ran the command again, it returns Gem bundler-2.2.23 cannot be uninstalled because it is a default gem.
How do I fix it?
I installed bundler with the command
gem install bundler --default -v 1.17.3
When I hit gem list, I get
bundler (default: 1.17.3)
But if I do bundler -v or bundler --version, I get
Bundler version 2.2.14
Which I did not install, so perhaps it was there before, or I have no idea.
The problem is I can't do bundle install because it gives me issues with the version, saying bundler > 2.0 isn't compatible with some of my gems.
Any help is appreciated.
I am using rvm and running Ruby 2.6.1 and using rails 5.2.2. When I try bundler -v
I get the error:
Traceback (most recent call last):
3: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `<main>'
2: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/ruby_executable_hooks:24:in `eval'
1: from /home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `<main>'
/home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `load': cannot load such file -- /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundler (LoadError)
gem list bundler returns:
*** LOCAL GEMS ***
bundler (2.0.2, default: 1.17.3, 1.17.2)
bundler-unload (1.0.2)
rubygems-bundler (1.4.5)
It seems that it is trying to look for the file named "bundler" in /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/ folder but there is no such file. The required file is in a different folder:
ls /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/
> bundler
How can I set it such that the bundler -v command looks into the bundler-1.17.2/exe instead of the bundler-1.17.3/exe? In other words I need to set the default bundler version as 1.17.2 instead of 1.17.3
I have run:
gem uninstall bundler
gem install bundler
bundle install
Which install successfully but still I get an error with bundler -v.
A similar post suggest reinstalling Rails gem install rails -v 5.2.2 but this did not fix my issue.
You can try by uninstalling the bundler with version
gem uninstall bundler -v 2.0.2
gem uninstall bundler -v 1.17.3
gem uninstall bundler -v 1.17.2
and then check the gem list that bundler has been uninstalled
gem list bundler
If its get uninstalled then you can install bundler with version again
gem install bundler -v 1.17.2
Or if its not uninstalled then might be bundler gem is in your default gemset so you can use the default gemset and then try uninstalling and then install 1.17.2 again
rvm gemset use default
gem uninstall bundler -v 2.0.2
gem uninstall bundler -v 1.17.3
gem uninstall bundler -v 1.17.2
gem install bundler -v 1.17.2
I know this is quite old, but just to help anyone that is facing the same problem:
/home/amairu/.rvm/gems/ruby-2.6.1#rails522/bin/bundler:23:in `load': cannot load such file -- /home/amairu/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundler (LoadError)
You have to reinstall the exact version that ruby is complying. In the error message above, it was looking for bundler version 1.17.3.
So you should only reinstall this exact version.
gem install bundler -v 1.17.3
I had a problem with Bundler (bundle cannot load such file bundler-1.17.1/exe/bundle), so I removed Bundler then manually removed all bundler directory:
gem uninstall bundler -x
gem cleanup bundler
Then removed with rm -rf from:
~/.gem/ruby/2.5.1/gems/bundler-1.17.1
~/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1
and ~/.bundle
Now, I would like to reinstall bundler with the default version, 1.17.1.
So I tried gem install bundler
gem install bundler
Fetching: bundler-1.17.1.gem (100%)
Successfully installed bundler-1.17.1
Parsing documentation for bundler-1.17.1
Installing ri documentation for bundler-1.17.1
Done installing documentation for bundler after 3 seconds
1 gem installed
If I try to execute a bundle command, I get this error:
bundle
Traceback (most recent call last):
1: from /Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `<main>'
/Users/robin/.gem/ruby/2.5.1/bin/bundle:23:in `load': cannot load such file -- /Users/robin/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1/exe/bundle (LoadError)
I can see bundler-1.17.1 in ~/.gem/ruby/2.5.1/gems/bundler-1.17.1 but not in .rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1. So I have to manually copy the folder:
cp -R ~/.gem/ruby/2.5.1/gems/bundler-1.17.1 ~/.rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.1
But now, if I try a bundle command, it works but I have this message in first line:
Warning: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.16.6). We suggest you upgrade to the latest version of Bundler by running 'gem install bundler'.
I tried to install bundler by gem install bundler -v 1.17.1 but I still have the problem.
gem list output:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 1.17.1)
capistrano-bundler (1.4.0, 1.3.0)
my config:
macOS 10.13.6
ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
chruby
ruby-2.5.0
* ruby-2.5.1
rails -v
Rails 5.2.1
gem -v
2.7.7
EDIT:
I forgot to specify than gem pristine bundler doesn't work with bundler:
gem pristine bundler
Restoring gems to pristine condition...
Skipped bundler-1.17.1, it is a default gem
And if I try to uninstall bundler twice, I get this message:
gem uninstall bundler -x
ERROR: While executing gem ... (Gem::InstallError)
gem "bundler" cannot be uninstalled because it is a default gem
So i don't know if bundler is really uninstalled the first time.
I've been following the railscast on setting up Vagrant with rails found here:
http://railscasts.com/episodes/292-virtual-machines-with-vagrant
I have rbenv running on vagrant with a slightly more updated version of ruby(1.9.3p125). Everything goes fine until I try to bundle. Here's the error I get:
vagrant#lucid32:/vagrant$ bundle
Fetching gem metadata from http:rubygems...
Fetching gem metadata from http:rubygems...
Resolving dependencies...
Using rake (10.0.3)
Errno::EPROTO: Protocol error - /vagrant/bin
An error occurred while installing rake (10.0.3), and Bundler cannot continue.
Make sure that gem install rake -v '10.0.3' succeeds before bundling.
I've tried gem installing that version of rake, then running rbenv rehash which seems to install, but running bundle again still gives me the same error.
I was able to resolve this by downgrading bundler from 1.3.2 to 1.2.5.
rvm use #global
gem uninstall bundler
gem install bundler -v 1.2.5
# switch back to the default gemset
rvm use
bundle install
# everything should work now
The only other thing that I changed was I reverted from rvm 1.18.19 to 1.17.10, but I am not positive that step is necessary.