npm WARN ENTENT ENOENT:没有此类文件或目录,请打开"C:\ Users \ Nuwanst \ package.json" [英] npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'
问题描述
我只想将socket.io安装到位于3.chat文件夹中的项目中.但是当我运行以下命令时,它显示以下警告.并且它没有在我的项目文件夹中创建一个node_modules目录.该如何解决?
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
`-- socket.io@2.0.3
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.
推荐答案
您是否创建了 package.json 文件?也许先重新运行此命令.
Have you created a package.json file? Maybe run this command first again.
C:\ Users \ Nuwanst \ Documents \ NodeJS \ 3.chat> npm init
它将在您的文件夹中创建一个 package.json 文件.
It creates a package.json file in your folder.
然后运行
C:\ Users \ Nuwanst \ Documents \ NodeJS \ 3.chat> npm install socket.io --save
-save
可确保将模块作为依赖项保存在 package.json 文件中.
The --save
ensures your module is saved as a dependency in your package.json file.
让我知道这是否可行.
这篇关于npm WARN ENTENT ENOENT:没有此类文件或目录,请打开"C:\ Users \ Nuwanst \ package.json"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!