'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
First, uninstall the version of Nokogiri you currently have with:
gem uninstall nokogiri
Download Nokogiri 1.6.6.2 (x64) or Nokogiri 1.6.6.2 (x86)
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:
- Look for the latest version of Nokogiri in Nokogiri's github repo.
- Run
gem uninstall nokogiri
. - Add
gem "nokogiri", ">= 1.6.7.rc"
to your Gemfile. - Run
bundle install
. - Run
bundle update nokogiri
if bundle has locked Nokogiri at some version.