Gem::InstallError: nokogiri requires Ruby version < 2.4, >= 2.1.0. rails

ruby-on-rails

Solution

You need to downgrade the version of `nokogiri` to `~> 1.6.8`

change nokogiri version in `Gemfile`

gem 'nokogiri', '~> 1.6.8'

Dependency for nokogiri version `1.6.8` is `ruby >= 1.9.2` https://rubygems.org/gems/nokogiri/versions/1.6.8

But it is changed for nokogiri version `1.7.1` to `ruby >= 2.1.0` https://rubygems.org/gems/nokogiri/versions/1.7.1

Problem

After running `rails new demo` I get the following error: ``` Gem::InstallError: nokogiri requires Ruby version < 2.4, >= 2.1.0. An error occurred while installing nokogiri (1.7.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.7.1'` succeeds before bundling. ``` My Ruby version is 1.9.3. I could update ruby but I'm worried that may create even more problems. Any suggestions? More Information: The Nokogiri gem is not listed in my Gemfile, if I run `gem list` it includes `nokogiri (1.6.8.1 x86-mingw32, 1.6.6.2 x86-mingw32, 1.6.1 x86-mingw32)`

Original source