Updated – Vagrant on Windows path limit fix

I previously shared my experience using PuPHPet to host a Linux VM on my Windows computer for MEAN stack development.  Since then I’ve made some improvements to the startup script I use to overcome Windows’s 260 character path limit, which  npm  and bower  easily exceed.

Here’s the latest script (and another nod to the GitHub discussion that started it):

And the updated method for calling it:

While the old script got the job done, it had many inconveniences.  The new version makes several improvements:

  • Temporary files are stored in /var/tmp  instead of /tmp , meaning they persist after the VM is restarted.
  • Building on that, the temporary directory name is now a hash of the mount point instead of choosing a new name every time.  This allows us to detect when the directory is already present then remount it.
  • The updated provisioner syntax in the Vagrantfile  causes the script to run during  vagrant reload  in addition to the usual vagrant up .

These updates avoid repeated setup of the mounted directories.  No more npm install  after every reload!

Leave a Reply

Your email address will not be published.