Bundler shows version I did not install - ruby-on-rails

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.

Related

problem installing canvas on ubuntu,Bundler could not find compatible versions for gem "bundler"

I'm trying to install canvas lms , but I have faced with the following issue. Any help. enter image description hereplease
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (>= 2.2.17, <= 2.2.24)
Current Bundler version:
bundler (2.2.28)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with gem install bundler:2.2.24 and rerun bundler using bundle _2.2.24_ update
I tried updating bundle but no success yet.
Try the following:
gem install bundler -v 2.2.24
bundle _2.2.24_ install

Bundler can't install signet

I've just removed rbenv as i wanted to install a newer Ruby version (2.6) than the ones available for rbenv, then installed Ruby 2.6, that went fine, now while trying to reinstall all the gems for my app I ran into the following problem:
$ bundle install
Installing signet 0.14.0
Gem::InstallError: signet requires Ruby version >= 2.4.0.
An error occurred while installing signet (0.14.0), and Bundler cannot continue.
Make sure that `gem install signet -v '0.14.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
google_drive was resolved to 2.1.12, which depends on
google-api-client was resolved to 0.21.2, which depends on
googleauth was resolved to 0.6.7, which depends on
signet
But ruby has clearly been upgraded:
$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux-gnu]
and if I try to install signet manually it works fine:
gem install signet -v '0.14.0' --source 'https://rubygems.org/'
Successfully installed signet-0.14.0
Parsing documentation for signet-0.14.0
Done installing documentation for signet after 0 seconds
1 gem installed
But then if i run bundle install again I still get the same problem. I've also tried bundle install --path vendor/cache and bundle install --system to no avail.
Note that the gems seem to install in the right place:
gem which signet
/var/lib/gems/2.6.0/gems/signet-0.14.0/lib/signet.rb
if I compare it to another one installed by bundler:
gem which multi_json
/var/lib/gems/2.6.0/gems/multi_json-1.14.1/lib/multi_json.rb
This is on Ubuntu 16.04.4 LTS and bundler 1.16.3
How do I fix this?
So I've finally figured it out, installing a newer version of bundler (but < 2.0 as Rails 4.2 requires it) did the trick, although i also had to uninstall the ruby 2.2-dev package and install the 2.6-dev package to be able to compile native gems like nokogiri, then running the whole thing specifying the bundler version.
For those interested, these were the commands:
apt-get remove ruby-dev
apt install ruby2.6-dev
gem install bundler -v 1.17.3
bundle _1.17.3_ install

Using multiple Bundler versions

I've joined a project which is using bundler version 1.17.1 . Currently my system is using bundler 2.0.2 . Is there any way for me to specify a bundler version just like specifying ruby version with rbenv. Something likes:
bundler --global 1.17.1
So that, when I run the command bundler -v I will receive the result 1.71.1 rather than 2.0.2
I tried to uninstall the current bundler with gem uninstall bundler and received this message:
$ gem uninstall bundler
Select gem to uninstall:
1. bundler-1.17.1
2. bundler-1.17.3
3. bundler-2.0.2
4. All versions
>
That makes me think there is a certain way allows me to work with multiple bundler versions. Any clues just for pointing me to where I should look up would be really appreciated.
EDIT 1
I tried bundle _1.17.1_ --version and it didn't work as I expected
$ bundler -v
Bundler version 2.0.2
$ bundle _1.17.1_ --version
Bundler version 1.17.1
$ bundler -v
Bundler version 2.0.2
expected: Bundler version 1.17.1
actual: Bundler version 2.0.2
Try this:
1) gem install bundler -v 1.17.1
2) bundle _1.17.1_ install
You can specify multiple bundler versions by using underscores: RubyGems already provides this functionality. Specify the version number in underscores as the first argument on the command line.
$ bundle _1.1.3_ --version
Bundler version 1.1.3
$ bundle _1.1.0_ --version
Bundler version 1.1.0
$ bundle _1.0.22_ --version
Bundler version 1.0.22
There's an issue in rbenv with a similar question: https://github.com/rbenv/rbenv/issues/235.
Hope this helps

How to solve bundler LoadError

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

Getting error on bundle install as (Bundler could not find compatible versions for gem "bundler")

Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.3.5) ruby
Current Bundler version:
bundler (1.2.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?
Above is the error that i am getting,already tried running 'gem install bundler'. It ran successfully,but bundle install is always throwing this error.Although its a dependancy gem,i have explicitly mentioned bundler gem in gemfile with the version 1.3.5,still getting the same error.Plz reply if anyone has come across such error or help me understand if i am doing something wrong.
you can force the bundler version in bundle install command like this:
bundle _1.2.3_ install.

Resources