ng发球会出错

问题描述 投票:0回答:3

我在角度9 cli上运行了ng serve命令,但出现这些错误:

发生未处理的异常:找不到模块'@ angular-devkit / build-angular / package.json'需要堆栈:-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ node_modules @ angular-devkit \ architect \ node \ node-nodes-modules-architect-host.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ node_modules @ angular-devkit \ architect \ node \ index.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ models \ architect-command.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ commands \ serve-impl.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ node_modules @ angular-devkit \ schematics \ tools \ export-ref.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ node_modules @ angular-devkit \ schematics \ tools \ index.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ utilities \ json-schema.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ models \ command-runner.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ lib \ cli \ index.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ lib \ init.js-C:\ Users \ hp \ AppData \ Roaming \ nvm \ v12.16.3 \ node_modules @ angular \ cli \ bin \ ng有关信息,请参见“ C:\ Users \ hp \ AppData \ Local \ Temp \ ng-gK2xYm \ angular-errors.log”进一步的细节。

angular command-line-interface angular-cli
3个回答
0
投票

安装@ angular-devkit / build-angular作为开发依赖项

npm install --save-dev @angular-devkit/build-angular

yarn add @angular-devkit/build-angular --dev

0
投票

尝试一下,

删除package-lock.json文件,node_modules文件夹。删除后,再次运行npm install


0
投票

似乎缺少npm安装。删除package-lock.json,node_modules文件夹并首先运行npm install

© www.soinside.com 2019 - 2024. All rights reserved.