Installing rails error: nokogiri requires Ruby version <2.4,> = 2.1.0

I am trying to install rails after installing ruby ​​2.4.1p111 on Windows 8.1 from "Start command line with Ruby (this is exactly the same as command line installed with ruby)".

I use the command gem install rails

and after a few seconds of pause The question title is being raised as an error.

I tried the command gem install nokogiri -v 1.7.1

and it gave the same error.

If I run it gem list

, it doesn't list nokogiri at all.

The possible solution I came across has read. Change the nokogiri version in the gem Gemfile

with some command gem 'nokogiri', '~> 1.6.8'

. I don't know if this even applies to the version of rails I installed. If this is a solution, how to implement it?

How to fix this error and install rails?

+3


source share


1 answer


Apparently there is an issue 1 in Nokogiri's compatibility with Ruby 2.4+, you can check the report here ; it will be fixed in Nokogiri 1.8.0.

In the meantime, you can use Ruby 2.3.4 until version 1.8.0 is released.

I don't know if this even applies to the version of rails installed.

No, this is not the case as you will be downgrading Nokogiri and will not solve the compatibility issue. This worked for users whose Ruby version was prior to 2.1.0



1 Please note (as pointed out in the comments) that this is a Windows only issue .

Edit:

You can now update your gemfile:

gem "nokogiri", (RUBY_VERSION >= "2.1" ? "~> 1.8" : "~> 1.6.8")

      

+5


source







All Articles