Travis Running Gem Install Bundler Without Version - ruby-on-rails

Travis is running the the command below and throwing an error:
$ gem install bundler
217ERROR: Error installing bundler:
218 The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.3.26. Try installing it with `gem install bundler -v 2.3.26`
219 bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
Now I don't know who told it to do that when I have the following in the .travis file:
before_install:
- gem install bundler -v 2.3.26
What could be causing travis to behave like this?

Related

Bundler shows version I did not install

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.

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

Travis CI build errors Windows, Ruby on rails app

I have actually 3 errors in Travis CI:
Here are the logs:
1:
Gem::InstallError: rack requires Ruby version >= 2.2.2.
Installing erubis 2.7.0
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
The command "eval bundle install --jobs=3 --retry=3 --deployment" failed. Retrying, 2 of 3.
I installed `gem install rack -v '2.0.1' but I did not help.
Also I changed my travis.yml file so it is
rvm:
- 2.2.2
instead of:
rvm:
- 2.2
2:
Gem::InstallError: rack requires Ruby version >= 2.2.2.
Installing websocket-driver 0.6.4
An error occurred while installing mime-types-data (3.2016.0521), and Bundler
cannot continue.
Make sure that `gem install mime-types-data -v '3.2016.0521'` succeeds before
bundling.
I installed `mime-types-data -v '3.2016.0521' but I did not help.
3:
Searching for binary rubies, this might take some time.
Requested binary installation but no rubies are available to download, consider skipping --binary flag.
Gemset '' does not exist, 'rvm rbx-2 do rvm gemset create ' first, or append '--create'.
The command "rvm use rbx-2 --install --binary --fuzzy" failed and exited with 2 during .
My travis.yml:
language: ruby
rvm:
- 2.2.2
- jruby
- rbx-2
before_install:
- gem update
- gem --version
before_script:
- psql -c 'create database listapp_test;' -U postgres
addons:
postgresql: '9.3'
I tried to update racks but I didn't help.
Ruby ver: ruby 2.2.4.p230
Does anyone know how to fix it?
Sounds like you are installing gem in places that Bundler cannot find it. It is much easier if you post build log URL that shows the problems you are having.
Note that Travis CI cannot support Rubinius on Precise any longer (issue #3 above) due to https://github.com/rubinius/rubinius/issues/3717. Try using Trusty instead.

travis ci rails build error when installing momentJS

I'm trying to incorporate travis ci in my project, the travis console output shows
An error occurred while installing momentjs-rails (2.11.0), and Bundler cannot
continue.
Make sure that `gem install momentjs-rails -v '2.11.0'` succeeds before
bundling.
even though in my .travis.yml I have
language: ruby
rvm:
- 2.2.1
before_install:
- gem update --system
- gem --version
- gem install momentjs-rails -v '2.11.0'
when I check the before install for moment js, it does say that
Fetching: momentjs-rails-2.11.0.gem (100%)
Successfully installed momentjs-rails-2.11.0
19 gems installed
so why is my build still getting the error with this gem?

Resources