npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'

user8109089 picture user8109089 · Aug 6, 2017 · Viewed 149.5k times · Source

I just want to install socket.io to my project which is located on 3.chat folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my project folder. How to fix this?

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm install socket.io
C:\Users\Nuwanst
`-- [email protected]

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'
npm WARN Nuwanst No description
npm WARN Nuwanst No repository field.
npm WARN Nuwanst No README data
npm WARN Nuwanst No license field.

Answer

Clive Mac picture Clive Mac · Aug 6, 2017

Have you created a package.json file? Maybe run this command first again.

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm init

It creates a package.json file in your folder.

Then run,

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm install socket.io --save

The --save ensures your module is saved as a dependency in your package.json file.

Let me know if this works.