Alex Godbehere Alex Godbehere - 3 months ago 9x
Node.js Question

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

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?


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.