我在角度9 cli上运行了ng serve命令,并且遇到了这些错误!
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- C:\Users\hp\AppData\Roaming\nvm\v12.16.3\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-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
See "C:\Users\hp\AppData\Local\Temp\ng-gK2xYm\angular-errors.log" for further details.
似乎缺少npm安装。删除node_modules文件夹,然后首先运行npm install。