0

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?

1

3 Answers 3

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

You also need ruby-build for rbenv, as it provides rbenv install. Also, I think rails 5 will need ruby 2.2.x or higher, so you're right on proposing ruby 2.3 :)
0

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.

Comments

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.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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.