I'm getting the following error:
ERROR: Error installing rails: mime-types-data requires Ruby version >= 2.0.
This happens while installing Rails on Ubuntu using the command:
sudo gem install rails
How can I fix this?
I'm getting the following error:
ERROR: Error installing rails: mime-types-data requires Ruby version >= 2.0.
This happens while installing Rails on Ubuntu using the command:
sudo gem install rails
How can I fix this?
As the error suggests, you need Ruby version 2.0 or later.
You are probably using system ruby. Not sure about Ubuntu 16, but earlier versions used to come with Ruby v1.9.3. You can check your current Ruby version by running the following code in your terminal:
ruby -v
For easier rubies version management, I would highly suggest to use one of the popular ruby version managers:
Install rvm and then install latest stable version.
# Using rvm
rvm install 2.3
# Using rbenv
rbenv install 2.3
The current ruby version in your system is below 2.0.
Try installing ruby 2.0 or higher versions before installing rails. That will solve the problem.
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.3p173 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.
Error: mime-types-data requires Ruby version >= 2.0
Notice: You shouldn't install rails
with sudo
permission.