node.js NPM 抛出错误“无法读取依赖项”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27637642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NPM throws error "couldn't read dependencies"?
提问by Anuo
NPM throws error "couldn't read dependencies"
NPM 抛出错误“无法读取依赖项”
yiffbook:home yiff$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/home/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path npm-debug.log
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/npm-debug.log
npm ERR! not ok code 0
Could you help me fix this?
你能帮我解决这个问题吗?
回答by user1524615
回答by harryy000
You are running npm install from /home.It tries to search for package.json in /home.Where is your node.js project?Example if its in C:\nodeproject\pasty.Then go to C:\nodeproject\pasty(the package.json will be there) and then do the npm install
您正在从 /home 运行 npm install。它尝试在 /home 中搜索 package.json。您的 node.js 项目在哪里?例如,它在 C:\nodeproject\pasty 中。然后转到 C:\nodeproject\pasty( package.json 将在那里)然后执行 npm install
回答by Kevin
This doesn't look like your issue, but for me this was caused by an invalid version number in package.json (had to change 2.4 to 2.4.0).
这看起来不像你的问题,但对我来说这是由 package.json 中的无效版本号引起的(必须将 2.4 更改为 2.4.0)。
回答by Ramneek Grover
It happens sometimes because of the old version of npmavailable.
Please update your npmto the latest version; this may solve your problem. If it doesn't, you can try installing externally relevant packages with version, for example:
有时会因为npm可用的旧版本而发生。请更新您npm的最新版本;这可能会解决您的问题。如果没有,您可以尝试使用版本安装外部相关的软件包,例如:
npm install sqlite3.

