npm install resulting in 'ENOENT: no such file or directory'

As already pointed out by Subburaj this is because you are missing a package.json.
Just run npm init to initialize that file for you; afterwards it should work.


If you are working on a Windows machine using Vagrant/VM, there's a chance that symlinks are the culprit for your problem. To determine if that is the case, simply copy your package.json and package-lock.json into a test directory that is not mounted/shared between OSs.

mkdir /tmp/symlinktest
cd {{your directory with your package*.json}}
cp package*.json /tmp/symlinktest
cd /tmp/symlinktest
npm install

If this results in a successful install, you'll need to either exclude the node_modules directory from the mount (there's various articles on doing this, however I can't say I've had success) or run npm install outside the mounted volume.


I was facing the same issue. I firstly delete my node_modules and delete the cache by following command:

rm -rf node_modules && npm cache clean --force

then I delete the package-lock.json file from my project and then hit npm install in command prompt and it works.

Tags:

Node.Js

Npm