I'm trying to set-up a development environment on a Virtualbox machine using Vagrant. I'm using Windows 10 as a host machine, and ubuntu/bionic64 as a guest machine.
My package.json file is located under a shared directory between the host machine and the guest machine. However whenever I run npm install --no-bin-links I do get the following error:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/vagrant/www/wp-content/plugins/my-plugin/node_modules/array-initial/node_modules/is-number/package.json.1640612897
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/www/wp-content/plugins/my-plugin/node_modules/array-initial/node_modules/is-number
/package.json.1640612897'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2021-01-19T05_31_47_272Z-debug.log
Inside the guest machine, if I copy the package.json and package-lock.json into another directory that is not shared, and then run npm install everything works perfectly.
mkdir /tmp/test/
cp package.json package-lock.json /tmp/test/
cd /tmp/test/ && npm install
# NPM Packages are installed successfully!
I think this error is specific to Windows, as I've been a user of Ubuntu for years, and never had a similar issue. I only started using Windows a week ago.
The strange thing is, I also have another development environment on the same machine, and NPM works just fine, without any issues on shared folders!
I used the --no-bin-links, so I don't think the issue has anything to do with the symbolic links.
Looking into the strace output, I can't see when this file node_modules/array-initial/node_modules/is-number /package.json.1640612897 was created.