Skip to content

Instantly share code, notes, and snippets.

@smonn
Last active December 14, 2015 14:18
Show Gist options
  • Save smonn/5099513 to your computer and use it in GitHub Desktop.
Save smonn/5099513 to your computer and use it in GitHub Desktop.
Issue with vagrant init: "No such file or directory".

After installing VirtualBox and Vagrant I tried to follow the getting started guide, but when I tried to run vagrant init I got this error:

C:\vagrant_guide> vagrant init
C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': No such file or directory - H: (Errno::ENOENT)
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:205:in `each'
    from C:/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/lib/vagrant/environment.rb:459:in `block in setup_home_path'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/lib/vagrant/environment.rb:454:in `each'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/lib/vagrant/environment.rb:454:in `setup_home_path'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/lib/vagrant/environment.rb:87:in `initialize'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/bin/vagrant:36:in `new'
    from C:/vagrant/embedded/gems/gems/vagrant-1.0.6.dev/bin/vagrant:36:in `<top (required)>'
    from C:/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `load'
    from C:/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `<main>'

It was looking for the H: drive, which in this case was a mapped network drive in Windows Explorer.

One solution is to simply run this command:

net use H: \\network\path

Another solution, which is probably better, is to change the HOMEDRIVE and HOMEPATH environment variables:

set HOMEDRIVE=C:
set HOMEPATH=\Users\<name>\

And then run vagrant init again, this time successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment