发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json'
Posted
技术标签:
【中文标题】发生未处理的异常:找不到模块\'@angular-devkit/build-angular/package.json\'【英文标题】:An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json' 【发布时间】:2021-09-16 04:13:21 【问题描述】:我从 Udemy 课程中下载了一个项目,我将从那里学习。但是,当我激活 ng serve -o 时,它会给我一系列错误:
PS C:\01-hola-mundo> ng 服务 -o 发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json' 需要堆栈:
C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\architect\node\node-modules-architect-host.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\architect\node\index.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\models\architect-command.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\commands\serve-impl.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\tools\export-ref.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\tools\index.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\utilities\json-schema.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\models\command-runner.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\lib\cli\index.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\lib\init.js C:\Users\GABRIEL\AppData\Roaming\npm\node_modules@angular\cli\bin\ng 有关详细信息,请参阅“C:\Users\GABRIEL\AppData\Local\Temp\ng-cFPBpp\angular-errors.log”。 PS C:\01-hola-mundo>【问题讨论】:
【参考方案1】:通常,当您下载 Angular 项目时,您需要执行 npm install 来安装依赖项。他们的错误是缺少依赖项,或者换句话说 node modules
不存在。
解决方案:npm install
注意:在根文件夹中执行此操作
【讨论】:
以上是关于发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json'的主要内容,如果未能解决你的问题,请参考以下文章
发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json'
离子应用程序:发生未处理的异常:找不到模块“@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/uti
找不到模块'@schemics/angular/utility/project'