Skip to content

Vagrant Configuration

Damian A. Pastorini edited this page Jun 16, 2019 · 3 revisions

While working on a Vagrant VM I've fount that if you are using a shared folder for your project code that's defined on your Vagrantfile, the folder permissions will not be the required to later run npm install.

For example:

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/bionic64"
    config.vm.hostname = "reldens"
    config.vm.network "private_network", ip: "192.168.33.55"
    config.vm.synced_folder "./src", "/home/vagrant/reldens"
end

For that matter, you will need to create a folder outside the shared one, like:

$ mkdir /home/vagrant/noderun

Then copy the package file:

$ cp /home/vagrant/reldens/package.json /home/vagrant/noderun/package.json

Go into the folder and run the installer there:

$ cd /home/vagrant/noderun && npm install

For last copy or move the node_modules into the shared folder:

$ cp -R /home/vagrant/noderun/node_modules /home/vagrant/reldens/

Then you will be able to just run npm start to run the project.