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

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


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


  1. First, uninstall the version of Nokogiri you currently have with:

    gem uninstall nokogiri
  2. Download Nokogiri 1.6.6.2 (x64) or Nokogiri 1.6.6.2 (x86)

  3. Install this version locally using:

    gem install --local C:\Users\$user$\Downloads\nokogiri-1.6.6.2-x64-mingw32.gem

    or if you're running 32bit Ruby:

    gem install --local C:\Users\$user$\Downloads\nokogiri-1.6.6.2-x86-mingw32.gem

    The path may differ depending on where you downloaded the file to.

Try to start the server again using ruby bin\rails server, and it should work.


I got Nokogiri running with Ruby 2.2 on Windows 10 with a mix of Mike Dalessios and Julios answer:

  1. Look for the latest version of Nokogiri in Nokogiri's github repo.
  2. Run gem uninstall nokogiri.
  3. Add gem "nokogiri", ">= 1.6.7.rc" to your Gemfile.
  4. Run bundle install.
  5. Run bundle update nokogiri if bundle has locked Nokogiri at some version.