我想启动一个Node应用程序,并使用教程创建了 package.json 文件。这是json文件:
{ "name": "Dashboard", "version": "0.0.0", "description": "Client-A Dashboard", "dependencies": { "socket.io": "latest", "express": "latest", "jade": "latest" }, "author": "tD" }
在尝试运行JSON文件之前,我已经对其进行了验证,但是在运行npm install命令时仍然收到错误消息:
npm install
npm ERR! install Couldn't read dependencies npm ERR! Error: ENOENT, open 'C:\projects\Client-A\Live\package.json' npm ERR! If you need help, you may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! <npm-@googlegroups.com> npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! cwd C:\projects\Client-A\Live\ npm ERR! node -v v0.8.22 npm ERR! npm -v 1.2.14 npm ERR! path C:\projects\Client-A\Live\package.json npm ERR! code ENOENT npm ERR! errno 34 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! C:\projects\Client-A\Live\npm-debug.log npm ERR! not ok code 0
这是 npm-degub.log 文件
0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@1.2.14 3 info using node@v0.8.22 4 verbose node symlink C:\Program Files (x86)\nodejs\\node.exe 5 verbose read json C:\projects\Client-A\Live\package.json 6 error install Couldn't read dependencies 7 error Error: ENOENT, open 'C:\projects\Client-A\Live\package.json' 8 error If you need help, you may report this log at: 8 error <http://github.com/isaacs/npm/issues> 8 error or email it to: 8 error <npm-@googlegroups.com> 9 error System Windows_NT 6.1.7601 10 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 11 error cwd C:\projects\Client-A\Live\scoreboard 12 error node -v v0.8.22 13 error npm -v 1.2.14 14 error path C:\projects\Client-A\Live\package.json 15 error code ENOENT 16 error errno 34 17 verbose exit [ 34, true ]
尝试添加以下内容:
"private": true,
它为我工作。
编辑 (对于问为什么的人):
该公报的文件规定如下:
如果"private": true在package.json中设置,则npm将拒绝发布它。这是防止意外发布私有存储库的方法。如果要确保仅将给定的程序包发布到特定的注册表(例如,内部注册表),请使用publishConfig下面描述的哈希值registry在发布时覆盖config参数。
"private": true
publishConfig
registry
您收到的错误消息可能与某种程度上违反了该“规则”有关(我以前是)。
"private": false