Error: mime-types-data requires Ruby version = 2.0
I was facing the same problem trying to install rails with sudo. I was getting:
ERROR: Error installing mime-types-data: mime-types-data requires Ruby version >= 2.0.
The thing is ruby -v
gives me ruby 2.2.1p85 while sudo ruby -v
gives me ruby 1.9.3p484, so instead of sudo gem install rails
I just did gem install rails
and it worked.
That is where I found my solution: https://github.com/jekyll/jekyll/issues/3558
Hope it helps.
Gem::InstallError: mime-types-data requires Ruby version = 2.0. and Travis-CI
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.
Error installing pg, requires Ruby version = 2.2 even if ruby is =2.2
When using RVM, it is necessary for some environment variables to be loaded to RVM (and RVM-installed Rubies) to find its code.
When running your gem install
command with sudo
however, sudo will reset your $PATH
and unset the required environment variables before executing the gem
command with the sanitized $PATH
. With that, you will likely use your system ruby rather than your RVM-installed ruby.
In general, you should not use sudo
to install Rubies or any gems when using RVM. Instead, you generally can and should just use your normal user.
If you do have to use sudo
with RVM for some reason, there is a special rvmsudo
command which retains your RVM environment in the evaluated context. See https://rvm.io/integration/sudo for details. However, as written above, you should try to avoid using this!
ZenTest requires RubyGems version ~ 1.8
The ~> 1.8
means "Any version of RubyGems, as long as it's 1.8 or higher, but smaller than 2.0". So 1.8.0
, 1.8.11
, 1.8.100
or 1.9
all match, but the version you have does not.
The 1.9.1
in the gem
command does not mean RubyGems is at version 1.9.1, but that it's the version that came with the Ruby 1.9.1 install. To find out what version of RubyGems you have, run gem1.9.1 --version
.
To resolve this, you can either upgrade Rubygems, or install a version of ZenTest that is compatible with the version of Rubygems you have by running sudo gem1.9.1 install ZenTest --version "< 4.6"
(assuming that ZenTest 4.5 is compatible with your RubyGems)
Related Topics
How to Make an Http Get With Modified Headers
Rails Installation Failed on Ubuntu With "Cannot Load Such File - Mkmf"
Why Should We Avoid Using Class Variables @@ in Rails
Rails: Skinny Controller Vs. Fat Model, or Should I Make My Controller Anorexic
Getting a "Bad Interpreter" Error When Using Brew
Ignoring Gem Because Its Extensions Are Not Built
How to Use Gem to Install Rails on Ubuntu
Rails Sends 0 Byte Files Using Send_File
Mavericks, Rbenv, Your Ruby Version Is 2.0.0, But Your Gemfile Specified 2.1.1
Execute a Sudo Command in Ruby on Rails App
Ruby: Class Instance Variables VS Instance Variables
Setspeed in Selenium Webdriver Using Ruby
What's the Precedence of Ruby'S Method Call
How to Avoid Trailing Empty Items Being Removed When Splitting Strings
Google Plus API Shutdown Today, Which Alternative Can Be Used to Authentication
Correctly Doing Redirect_To :Back in Ruby on Rails When Referrer Is Not Available