'require': cannot load such file -- 'nokogiri\nokogiri' (LoadError) when running `rails server`

Shef picture Shef · Mar 12, 2015 · Viewed 56.2k times · Source

I'm running a clean install of Ruby 2.2.1 on Windows 8.1 with DevKit. After the installation I run:

gem install rails
rails new testapp
cd testapp
rails server

leaving everything else at default.

The process fails at the last line when, instead of running the server, I get the error message

in 'require': cannot load such file -- 'nokogiri\nokogiri' (LoadError)

It happens every time and I've looked around and tried everything I found to fix it, but nothing so far has worked.

What is the problem here and how do I get a simple test Rails app to work?

Answer

Mike Dalessio picture Mike Dalessio · Mar 12, 2015

Nokogiri doesn't support Ruby 2.2 on Windows yet. The next release will. See https://github.com/sparklemotion/nokogiri/issues/1256

Nokogiri doesn't support native builds (e.g. with devkit) on Windows. Instead it provides gems containing prebuilt DLLs.

There's a discussion which you may want to join or watch on the topic of devkit build support here: https://github.com/sparklemotion/nokogiri/issues/1190