[在此处输入图像描述][1] [1]:https://i.stack.imgur.com/axbtO.png
"An unhandled exception occurred: Cannot find module '@angular/compiler-cli'
尝试运行时获取“ ng serve
”
我得到的错误
PS D:\Study\PoolCarz> ng serve
An unhandled exception occurred: Cannot find module '@angular/compiler-cli'
Require stack:
- D:\Study\PoolCarz\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js
- D:\Study\PoolCarz\node_modules\@ngtools\webpack\src\index.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\build-angular\src\webpack\configs\typescript.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\build-angular\src\webpack\configs\index.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\build-angular\src\utils\package-chunk-sort.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\build-angular\src\browser\index.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
- D:\Study\PoolCarz\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- D:\Study\PoolCarz\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\index.js
- D:\Study\PoolCarz\node_modules\@angular\cli\models\architect-command.js
- D:\Study\PoolCarz\node_modules\@angular\cli\commands\serve-impl.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\schematics\tools\export-ref.js
- D:\Study\PoolCarz\node_modules\@angular-devkit\schematics\tools\index.js
- D:\Study\PoolCarz\node_modules\@angular\cli\utilities\json-schema.js
- D:\Study\PoolCarz\node_modules\@angular\cli\models\command-runner.js
- D:\Study\PoolCarz\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\smriti.bhawana\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\smriti.bhawana\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\SMRITI~1.BHA\AppData\Local\Temp\ng-CvHKUy\angular-errors.log" for further details.
Package.json 文件包含以下内容:
{
"name": "pool-carz",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.2.3",
"@angular/common": "~11.2.3",
"@angular/compiler": "~11.2.3",
"@angular/core": "~11.2.3",
"@angular/forms": "~11.2.3",
"@angular/platform-browser": "~11.2.3",
"@angular/platform-browser-dynamic": "~11.2.3",
"@angular/router": "~11.2.3",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1101.4",
"@angular/cli": "^11.2.2",
"@angular/compiler-cli": "~11.2.3",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.2.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "^4.1.5"
}
}
版本
Angular CLI: 11.2.2
Node: 14.15.5
OS: win32 x64
Angular: 11.1.2
... animations, common, compiler, core, forms, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1101.4
@angular-devkit/build-angular 0.1101.4
@angular-devkit/core 11.1.4
@angular-devkit/schematics 11.2.2
@angular/cli 11.2.2
@angular/compiler-cli <error>
@schematics/angular 11.2.2
@schematics/update 0.1102.2
rxjs 6.6.6
typescript 4.1.5
npm 版本
{
'pool-carz': '0.0.0',
npm: '6.14.11',
ares: '1.16.1',
brotli: '1.0.9',
cldr: '37.0',
icu: '67.1',
llhttp: '2.1.3',
modules: '83',
napi: '7',
nghttp2: '1.41.0',
node: '14.15.5',
openssl: '1.1.1i',
tz: '2020a',
unicode: '13.0',
uv: '1.40.0',
v8: '8.4.371.19-node.18',
zlib: '1.2.11'
}