简体   繁体   中英

ERROR: Error installing rails on ubuntu

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?

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM