npm安装:安装无法读取依赖项。

3
我已开始学习Angular JS。我正在构建简单的phonecat应用程序,具体步骤可以参考此处
我在按照步骤进行操作。已经下载了Node.js并尝试执行命令:npm install出现错误: C:>npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (
x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! path C:\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058

npm ERR! package.json ENOENT, open 'C:\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 directo
ry.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (
x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1

npm ERR! Uncaught, unspecified "error" event.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\npm-debug.log

C:\>

2
你的目录中没有 package.json 文件。 - Bidhan
此为Stack Overflow问题的副本。 - mscdex
是的,我有:路径为:C:\Program Files (x86)\nodejs\node_modules\npm - VBMali
2
如果您正在跟随教程,则必须克隆项目并进入目录。该目录必须有一个package.json文件。然后,执行npm install命令。 - Bidhan
移动到目录中。这很有帮助。 - VBMali
5个回答

8

在执行npm install命令之前, 请先执行cd myproject,然后再执行npm install

问题已解决。谢谢。


1

1

就像Bilhan A说的那样:你需要切换到克隆项目的文件夹。从你的问题中我假设你是新手并且想要主要学习Angularjs。这不需要Node.js。如果你真的想学Angular,我推荐像this one这样的教程,它们不需要node.js。当你理解了它的工作原理后,再回来使用node.js并将它们结合起来。


1
< p > package.json 中的 name 字段应该与您项目目录的名称相同。


0
如果显示此错误,则只需更新npm,我现在遇到了这个问题,这就是为什么我在这里更新的原因,它可能会帮助某个人。
$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" 
"C:\\Program F iles\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" 
"install"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! path C:\Users\joy\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open     
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    
npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\joy\Desktop\TEMP\node\chatsys\npm-debug.log

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接