javascript npm install: install 无法读取依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30723943/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 12:36:53  来源:igfitidea点击:

npm install: install Couldn't read dependencies

javascriptangularjsnode.js

提问by VBMali

I have started to learn Angular JS. I am going through this, that is building simple phonecat app

我已经开始学习Angular JS。我正在经历这个,那就是构建简单的phonecat 应用程序

I am following the steps. Node.js downloaded.Trying to execute this command: npm install

我正在按照步骤操作。已下载 Node.js。尝试执行此命令:npm install

Error occured:C:>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:\>

回答by VBMali

Before executing the command npm installExecute this cd myprojectand then execute this: npm install

在执行命令之前执行npm install这个cd myproject然后执行这个:npm install

Its solved.Thanks.

它解决了。谢谢。

回答by Mahesh Thumar

It looks like you haven't put the package.json file in root directory. If you are starting fresh, you'll need to clone this repo. https://github.com/angular/angular-phonecat

看起来您还没有将 package.json 文件放在根目录中。如果你刚开始,你需要克隆这个 repo。https://github.com/angular/angular-phonecat

回答by Brasilikum

Like Bilhan A said: you need to change to the folder where you cloned the project to. From your question I am assuming you are new to programming and want to learn Angularjs primarily. Node.js is not needed for this. If you really want to learn Angular, I recommend Tutorials like this one, which do not require node.js. When you understood how it works, come back to node.js and combine them.

就像 Bilhan A 所说:您需要更改到您将项目克隆到的文件夹。根据您的问题,我假设您是编程新手,并且主要想学习 Angularjs。为此不需要 Node.js。如果你真的想学习 Angular,我推荐像这样的教程,它不需要 node.js。当您了解它的工作原理后,请回到 node.js 并将它们组合起来。

回答by Igor

namefield in package.jsonshould be the same with name of your project directory.

name字段package.json应与您的项目目录名称相同。

回答by user3728517

If this is the error displayed then simply update the npm,i face this issue now that's why i update here,it might be help some one

如果这是显示的错误,那么只需更新 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