Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install plugin hostmanager in vagrant in windows 8.1

Not able to install plugin its showing the below error...

C:\devbox>vagrant plugin install 'vagrant-hostmanager' The directory where plugins are installed (the Vagrant home directory) has a space in it. On Windows, there is a bug in Ruby when compiling plugins into directories with spaces. Please move your Vagrant home directory to a path without spaces and try again.

like image 647
kumarswamy kc Avatar asked Sep 29 '14 14:09

kumarswamy kc


2 Answers

Ruby (language used by Vagrant) has "issues" with directory names that contain spaces.

Vagrant will use an environment variable (supplied by windows) to tell it where your user directory is (so it can decide where to put your "home" directory). But you might have a space in your user name (I do) which causes a problem for ruby (which is doing the work to install the plugin).

The solution is to move your project to a project directory you choose that doesn't have any spaces in the directory name. Then, use an environment variable called VAGRANT_HOME and set it to a specified directory. The plugin installation procedure will check for the existence of this variable and use it if it exists instead of locating a home directory within the windows current user directory.

I created a folder called home within C:\Hashicorp\Vagrant and used that (C:\Hashicorp\Vagrant\home).

Setting windows environment variables is not hard (rather trivial actually) - you can find out how here: http://www.computerhope.com/issues/ch000549.htm

You'll have to do a restart to your system for it to take effect (it all worked after a reboot for me).

like image 189
Reinsbrain Avatar answered Sep 19 '22 06:09

Reinsbrain


I've found a slight variation to the @Reinsbrains answer. In order to have a home directory without spaces within its name. I created a junction to my user/home directory. In my case I decided to go with a Linux style structure, but any location would work. In an admin command prompt:

mkdir c:\home
mklink /j c:\home\maarten "c:\users\Maarten Bicknese"

Next set the VAGRANT_HOME environment variable to the newly created junction.

setx VAGRANT_HOME c:\home\maarten

Fire up a new command prompt and you're good to go!

like image 22
Maarten Bicknese Avatar answered Sep 19 '22 06:09

Maarten Bicknese