“无法读取依赖关系” npm错误 [英] "Couldn't read dependencies" error with npm
问题描述
我想启动一个Node应用程序并使用教程创建 package.json 文件。这是json文件:
I wanted to start a Node app and created a package.json file with a tutorial. Here is the json file:
{
"name": "Dashboard",
"version": "0.0.0",
"description": "Client-A Dashboard",
"dependencies": {
"socket.io": "latest",
"express": "latest",
"jade": "latest"
},
"author": "tD"
}
我在尝试运行它之前验证了JSON文件,但是当我运行 npm install时仍然收到错误信息
命令:
I verified JSON file before trying to run it, but still I got an error message when I ran the npm install
command:
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 file
and here is the npm-degub.log file
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,
它对我有效。
编辑(有人问为什么):
官方文档声明如下:
如果你设置<$在你的package.json中c $ c>private:true ,然后npm将拒绝发布它。
这是一种防止意外发布私有存储库的方法。如果您希望确保给定的包只发布到特定的注册表(例如,内部注册表),那么使用下面描述的 publishConfig
哈希来覆盖注册表
发布时的配置参数。
If you set "private": true
in your package.json, then npm will refuse to publish it.
This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the publishConfig
hash described below to override the registry
config param at publish-time.
您收到的错误消息可能与以某种方式违反此规则有关(我的)。
The error messages you are getting may be related to violating this "rule" in a way (mine was).
- 您要么标记一个未发布的软件包(比如你自己的应用程序)为
private:false
。 - 或者你忽略了包括任何价值。
这篇关于“无法读取依赖关系” npm错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!