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_mod
the file path you ran is wrong. So if you are working on windows, go to the correct file location with cd and rerun from there.
I had this in a new project on Windows. npm install
had created a node_modules
folder for me, but it had somehow created the folder without giving me full control over it. I gave myself full control over node_modules
and node_modules\.staging
and it worked after that.
Seems you have installed express in root directory.Copy path of package.json and delete package json file and node_modules folder.
we need to create package.json by entering npm init
and enter package name as package.json and optionally fill other requirements else press enter and at last
enter yes to confirm.
Great!!
Now install any npm package without any error.
npm install <package_name>
Windows10
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.
finally, I got a solution if you are getting:-
**npm WARN tar ENOENT: no such file or directory,.......**
then it is no issue of npm or its version it is os permission issue to resolve this you need to use below command:-
sudo chown -R $USER:$USER *
additional
sudo chmod -R 777 *
then run:-
sudo npm i