Vagrant QI - Split node_modules
gtirloni at ocadu.ca
Tue Nov 8 18:45:53 UTC 2016
Some people have experienced issues with node_modules and symlinks
being unsupported inside VirtualBox shared folders (Windows); or
occasional issues when the VM operating system is a different
architecture (e.g. Windows/OSX host and Linux VM) and they try to share
the node_modules (using VirtualBox Shared Folders).
If you have experienced such issues (Windows and OSX users are most
likely to), please consider adding the following code snippet to your
Vagrantfile, right below the config.vm.synced_folder so it gets executed
first when the VM boots:
This will ensure the node_modules directory inside the VM is separate
from the one on the host OS, so `npm install` (or `yarn install`) can
The rest of the code in the repository continues to be shared as a
single entity, just like always. With this solution, we "pierce a hole"
into the VirtualBox shared folder and mount the node_modules directory
locally within the VM (in this case, in /var/tmp, outside the shared
Regarding the ability to avoid having to keep Vagrantfile within the
repositories, we are working on a Vagrant plugin to automate this work.
As this touches various areas (local tests, hosted CI, the YAML config
file), work has been progressing slowly as these pieces mature. At this
time the code is still alpha quality.
More information about the fluid-work