6

I am attempting to install the vagrant-vbguest plugin in Windows 7 from within cygwin 64.

$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

Performing the suggested step results in:

$ gem install json -v '1.8.1'
Building native extensions.  This could take a while...
Successfully installed json-1.8.1
1 gem installed
Installing ri documentation for json-1.8.1...
Installing RDoc documentation for json-1.8.1...

Running the first command then fails in the same way.

3 Answers 3

7

This can occur if you install Vagrant in a folder containing spaces. For example, C:\Program Files\HashiCorp\Vagrant instead of the default C:\HashiCorp\Vagrant.

Two solutions are available to you:

  • Reinstall Vagrant to a folder without any spaces (eg. the default installation folder)
  • Modify your PATH environmental variable to use the legacy folder shortnames in place of folders with spaces. For example, Program Files becomes PROGRA~1 and Program Files (x86) becomes PROGRA~2 (in most cases, you should verify this yourself by typing these paths in and verifying the two shortnames map to the same folders as I specified).

To modify your environmental variables, go to Control Panel, System, Advanced System Settings, click on the Advanced Tab, and then click the Environmental Variables button at the bottom of the window. In the System variables frame, select the Path variable and then click Edit. From there, change the path of your Vagrant bin to use shortnames in place of folders with spaces. In my case, since I installed Vagrant in Program Files (x86) directory, my Path variable looks something like this:

[semi-colon delimited list of other paths];C:\PROGRA~2\HashiCorp\Vagrant\bin

After you've done this, open a new command prompt and try your plugin installation again.

2

You can install the plugin locally.

  • Download the plugin gem from https://rubygems.org/ and store it somewhere (C:\somewhere)
  • In the plugin location, execute the below command:

    C:\somewhere>vagrant plugin install vagrant-vbguest-0.10.0.gem
    
2
  • This is the easiest solution on Windows. No brainer :-)
    – Vacilando
    Mar 16, 2016 at 19:34
  • Why is this not documented? I’ve spent two days on this. I’m making a PR right away!
    – renoirb
    Apr 6, 2016 at 23:33
1

Vagrant comes with its own embedded ruby, and doesn't use system ruby. So you need to install/reinstall gem by using the embedded gem utility.

For example on my OS X:

~ ->  /Applications/Vagrant/embedded/bin/gem list

*** LOCAL GEMS ***

bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
test-unit (2.0.0.0)

Locate Vagrant's gem and and try running install again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .