Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant on windows error 'cannot load such file' nokogiri

I'm trying to run a vagrant up command to create a box on AWS. The vagrant file already works on my Mac now I'm trying to run on Windows. I've just installed the latest Vagrant for Windows (1.8.1) and installed the AWS Plugin.

When I run vagrant up I get the following output

C:/HashiCorp/Vagrant/embedded/gems/gems/nokogiri-1.6.3.1-x86-mingw32/lib/nokogiri.rb:29:in require': cannot load such file -- nokogiri/nokogiri (Load Error) from C:/HashiCorp/Vagrant/embedded/gems/gems/nokogiri-1.6.3.1-x86-mingw32/lib/nokogiri.rb:29:in rescue in ' from C:/HashiCorp/Vagrant/embedded/gems/gems/nokogiri-1.6.3.1-x86-mingw32/lib/nokogiri.rb:25:in ' from C:/Users/renato.mintz/.vagrant.d/gems/gems/fog-xml-0.1.2/lib/fog/xml.rb:2:in require' from C:/Users/renato.mintz/.vagrant.d/gems/gems/fog-xml-0.1.2/lib/fog/xml.rb:2:in `' from C:/Users/renato.mintz/.vagrant.d/gems/gems/fog-1.37.0/lib/fog.rb:13:in require' from C:/Users/renato.mintz/.vagrant.d/gems/gems/fog-1.37.0/lib/fog.rb:13:in ' from C:/Users/renato.mintz/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/connect_aws.rb:1:in require' from C:/Users/renato.mintz/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/connect_aws.rb:1:in ' from C:/Users/renato.mintz/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action.rb:97:in block in action_read_state' ...

and it continues...

I've found some posts about nokogiri not running on ruby for Windows 2.2 but I'm not sure if this has any fix yet.

Any clue on how to fix or bypass this issue?

like image 641
remintz Avatar asked Feb 17 '16 11:02

remintz


1 Answers

This is a known issue (https://github.com/mitchellh/vagrant/issues/6766), pending fix, caused by vagrant fixing a low version of nokogiri.

In the meantime, in C:\HashiCorp\Vagrant\embedded\gems\specifications\vagrant-1.8.1.gemspec you'll find the gemspecs with the problematic nokogiri references.

Change the nokogiri reference in C:\HashiCorp\Vagrant\embedded\gems\specifications\vagrant-1.8.1.gemspec and C:\HashiCorp\Vagrant\embedded\gems\specifications\vagrant.gemspec (if it exists) from <nokogiri>, ["= 1.6.3.1"] to <nokogiri>, [">= 1.6.3.1"] (note the >= as opposed to =).

Once you've done this, you can then run the following to allow vagrant access to a version of nokogiri that isn't problematic:

vagrant plugin install nokogiri --plugin-version 1.6.7.1

Vagrant up should then work once more. Hopefully an updated version of vagrant isn't too far off now anyhow.

like image 127
Rich O'Kelly Avatar answered Nov 11 '22 21:11

Rich O'Kelly