Alex Godbehere Alex Godbehere - 1 year ago 168
Node.js Question

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

I've installed Node.js for Windows and I'm trying to install a package via npm. The command prompt is in the directory of the project (C:\Users\username\Desktop\NodeTest), which contains a single helloworld.js file. Upon typing 'npm install express', I receive the following error:

ENOENT: no such file or direcotry, open 'C:\Users\username\package.json

I'm attempting this from a clean install and cmd is running as admin.

Any ideas?

Answer Source

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.