travis ci rails build error when installing momentJS - ruby-on-rails

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?

Related

Travis Running Gem Install Bundler Without Version

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?

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

Gem install the wrong version of bundler

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.

Rails : bundle install nokogiri fail

When I run > bundle install
`An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Ok, so I run > sudo gem install nokogiri -v '1.6.2.1'
I have this :
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.2.1/ext/nokogiri/gem_make.out
When I run the command : rails g controller...
Could not find gem 'rspec-rails (= 2.13.1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
Please help me!
Possible duplicates:
Mac OS X: Error to install Nokogiri on OSX 10.9 Maverick?
Ubuntu: Error installing Nokogiri 1.5.0 with rails 3.1.0 and ubuntu
The problem is probably that you have to natively install libxml and libxslt, which Nokogiri relies on.
If you run gem install nokogiri -v '1.6.2.1' | grep libxml, does anything show up?

Issue while installing Ruby Rails on CentOs

When iam trying to install Ruby Rails on my centos server .When i enter Bundle install i got the error
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that gem install pg -v '0.14.1' succeeds before bundling.
When i try `gem install pg -v '0.14.1 got the below error
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out
Anybody know why i get this error? Help is highly appreciated.
This should help you --
$ sudo yum install postgresql-devel
Setting up Install Process
...
Complete!
$ sudo gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.14.1
1 gem installed
Installing ri documentation for pg-0.14.1...
Installing RDoc documentation for pg-0.14.1...

Resources