简体   繁体   中英

NGCC Failing to compile when running ng serve

I tried updating peer dependencies but when I finished, I was no longer able to compile my angular app. The output I get is:

Compiling @angular/material/core : es2015 as esm2015
Compiling @angular/material/expansion : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling ngx-plyr : es2015 as esm2015
Error: Error on worker #2: TypeError: Cannot read property 'map' of null
    at ComponentDecoratorHandler.analyze (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/component.js:215:47)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:346:40)
    at analyze (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:298:58)
    at _loop_1 (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:320:21)
    at NgccTraitCompiler.TraitCompiler.analyzeClass (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:326:35)
    at NgccTraitCompiler.analyzeFile (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:48:26)
    at DecorationAnalyzer.analyzeProgram (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:140:39)
    at Transformer.analyzeProgram (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:130:57)
    at Transformer.transform (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:76:27)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/create_compile_function.js:52:42
    at ClusterMaster.onWorkerMessage (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:140:27)
    at Object.next (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:121:57)
    at /Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:114:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:110:16)
    at EventEmitter.<anonymous> (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:315:20)
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/32/x18y24p96ps3ycfgmnnx4cj80000gn/T/ng-GofkCm/angular-errors.log" for further details.
➜  Impero (node:55757) UnhandledPromiseRejectionWarning: Error: write EPIPE
    at process.target._send (internal/child_process.js:806:20)
    at process.target.send (internal/child_process.js:677:19)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:51:21
    at new Promise (<anonymous>)
    at Object.exports.sendMessageToMaster (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:46:16)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:104:66
    at step (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:140:27)
    at Object.next (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:121:57)
    at /Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:114:75
    at new Promise (<anonymous>)
(node:55757) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:55757) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:55754) UnhandledPromiseRejectionWarning: Error: write EPIPE
    at process.target._send (internal/child_process.js:806:20)
    at process.target.send (internal/child_process.js:677:19)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:51:21
    at new Promise (<anonymous>)
    at Object.exports.sendMessageToMaster (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:46:16)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:104:66
    at step (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:140:27)
    at Object.next (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:121:57)
    at /Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:114:75
    at new Promise (<anonymous>)
(node:55754) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:55754) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:55756) UnhandledPromiseRejectionWarning: Error: write EPIPE
    at process.target._send (internal/child_process.js:806:20)
    at process.target.send (internal/child_process.js:677:19)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:51:21
    at new Promise (<anonymous>)
    at Object.exports.sendMessageToMaster (/Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/utils.js:46:16)
    at /Users/cristianofirmani/Docs/Impero/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:104:66
    at step (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:140:27)
    at Object.next (/Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:121:57)
    at /Users/cristianofirmani/Docs/Impero/node_modules/tslib/tslib.js:114:75
    at new Promise (<anonymous>)
(node:55756) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:55756) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My Angular versions are as follows:


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.1.3
Node: 12.18.4
OS: darwin x64

Angular: 11.0.0-next.3
... core
Ivy Workspace: Yes

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.1001.2
@angular-devkit/build-angular       0.1001.2
@angular-devkit/core                10.1.2
@angular-devkit/schematics          10.1.3
@angular/animations                 11.0.0-next.1
@angular/cdk                        10.2.1
@angular/cli                        10.1.3
@angular/common                     11.0.0-next.4
@angular/compiler                   11.0.0-next.1
@angular/compiler-cli               10.1.4
@angular/forms                      11.0.0-next.1
@angular/language-service           11.0.0-next.1
@angular/material                   10.2.0
@angular/platform-browser           11.0.0-next.1
@angular/platform-browser-dynamic   11.0.0-next.1
@angular/router                     11.0.0-next.1
@schematics/angular                 10.1.3
@schematics/update                  0.1001.3
rxjs                                6.6.3
typescript                          4.0.2

I have tried removing node modules and reinstalling them. I have tried updating to the latest cli version. I have tried pre-running ngcc as explained on this bug report. I have tried disabling and re-enabling Angular Ivy.

Any help would be greatly appreciated. Let me know if you need any further info and I will gladly provide.

正如 nrausch 所建议的,降级到 Angular 9 并禁用 Ivy 就成功了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM