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

前端 未结 15 677
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 23:19

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

相关标签:
15条回答
  • 2020-12-13 00:09

    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.

    0 讨论(0)
  • 2020-12-13 00:13

    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.

    0 讨论(0)
  • 2020-12-13 00:16

    Seems you have installed express in root directory.Copy path of package.json and delete package json file and node_modules folder.

    0 讨论(0)
  • 2020-12-13 00:16

    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

    0 讨论(0)
  • 2020-12-13 00:19

    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.

    0 讨论(0)
  • 2020-12-13 00:20

    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 
    
    0 讨论(0)
提交回复
热议问题