John Towery John Towery - 16 days ago 12
Ruby Question

Gem::InstallError: mime-types-data requires Ruby version >= 2.0. and Travis-CI

I have this error in Travis-CI:

Using rack 1.6.4
Using arel 6.0.3
Gem::InstallError: mime-types-data requires Ruby version >= 2.0.
Installing debug_inspector 0.0.2
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.
The command "eval bundle install --jobs=3 --retry=3 --deployment" failed 3 times.
The command "bundle install --jobs=3 --retry=3 --deployment" failed and exited with 5 during .
Your build has been stopped.




I did look all over the stackoverflow and tried all of thier suggestion but doesn't seems to solve the problem.

Here are my current Ruby version:

$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

$ sudo ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]


I have rails that use rails 4.2.6
I'm using a simple rails setup just for learning to better understand it better.

inside my
.travis.yml
:

language: ruby

sudo: required

#before_deploy:
#- gem install mime-types -v 2.6.2




-I commented out the
befor_deploy
because it didnt solve the problem.

So I added
sudo: required
and the problem seems to be solved. I find that odd because that is first time I had to use
sudo
when working on rails app.

Is that an ideal solution (using
sudo: required
)?

I've been on it for few days and wasnt really sure why.

I'm using MacOS 10.11.6 and i've installed Ruby/Rails environment using Homebrew.

Answer

try to compare the output of $ ruby -v $ sudo ruby -v

In general is a good practice to use a version management system. Ruby has rvm. This allows you to set for each and every project the ruby version you want to use.

After installing it, you should declare in the root of your app which version you wanto to use ($ rvm use ruby-x.y.z) and create two files .ruby-version and .ruby-gemset to make your settings available at any time.

Travis has a native support for rvm, so you will be sure about the Ruby version your project is tested against.

Comments