Nokogiri requires Ruby version < 2.3
Asked Answered
S

5

8

I am trying to get Rails to work on Windows 10. I am using Ruby 2.3.0, and Rails 4.2.6, and am temporarily using Nokogiri 1.6.3.

When I try running rails new demo, it returns an error:

An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.

When I run gem install nokogiri -v '1.6.7.2 I get:

ERROR:  Error installing nokogiri:
        nokogiri requires Ruby version < 2.3, >= 1.9.2.

How do I update Nokogiri and get Rails to work?

Soidisant answered 26/4, 2016 at 14:45 Comment(3)
what does ruby -v output?Claman
it seems just for windows, in linux it workds for 2.3.0 rubyCadel
It's a shame, but unless you want to try the release candidate approach, you'll need to downgrade your Ruby version. Another option would be to try JRuby, if that's not too drastic a thing for you. JRuby might be helpful in reducing the OS-specific issues Windows Rubyists might encounter.Breastsummer
S
13

Install the newest version of Nokogiri. In Gemfile:

gem 'nokogiri', '~> 1.6.8.rc2'
Surbeck answered 26/4, 2016 at 14:53 Comment(2)
It's not a command, it's a line for the Gemfile. After adding it you have to run bundle install. If you have bundler installed and just do a gem install, you will have two versions of nokogiri installed but the project will still use the old one.Jedjedd
this does fix the issue, same version as poster, Win10, Ruby 2.3.0p0. can you explain what is causing the issue, and what this line does to fix it?Broomstick
W
3

use bundle update nokogiri, but also check you ruby version ruby -v

Whelk answered 26/4, 2016 at 14:55 Comment(1)
ruby -v : ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32] bundle update nokogiri : This Bundle hasn't been installed yet. Run 'bundle install' to update and install the bundled gems.Soidisant
C
1

Problem solved in version of Nokogiri 1.8.0.

Clepsydra answered 6/7, 2017 at 16:11 Comment(0)
T
-1

I had the same problem as you. On Windows you need to perform an additional step:

http://www.nokogiri.org/tutorials/installing_nokogiri.html

Tarra answered 28/4, 2016 at 12:9 Comment(1)
Yes, that's how I got the initial nokogiris but I need 1.6.7.2 specifically for it to work. In this case, when I use the gem, the same error occurs.Soidisant
L
-1

I recently ran into the same problem installing rails on windows with Ruby v2.4.1 I found that removing the gemfile line:

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

then running bundle update

then putting the tzinfo-data line back in the gemfile

I could then run bundle without any issue. All is working well again.

Linage answered 27/6, 2017 at 5:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.