【问题标题】:NGCC Failing to compile when running ng serveNGCC 运行 ng serve 时编译失败
【发布时间】:2020-10-01 05:03:00
【问题描述】:

我尝试更新对等依赖项,但完成后,我不再能够编译我的 Angular 应用程序。我得到的输出是:

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.

我的 Angular 版本如下:


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

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

我已尝试删除节点模块并重新安装它们。 我已经尝试更新到最新的 cli 版本。 我已尝试按照this 错误报告中的说明预运行 ngcc。 我已经尝试禁用和重新启用 Angular Ivy。

任何帮助将不胜感激。如果您需要任何进一步的信息,请告诉我,我很乐意提供。

【问题讨论】:

  • 我猜你的插件 ngx-plyr 还没有为 Angular Ivy 做好准备。因此,您可以禁用 Ivy,降级到 Angular 8(甚至可能 9 个作品?)或使用另一个库来包含 Plyr。此外,提及日志文件/private/var/folders/32/x18y24p96ps3ycfgmnnx4cj80000gn/T/ng-GofkCm/angular-errors.log 可能包含有关您的问题的更多信息。

标签: node.js angular typescript


【解决方案1】:

正如 nrausch 建议的那样,降级到 Angular 9 并禁用 Ivy 就可以了。

【讨论】:

    猜你喜欢
    • 2019-06-23
    • 1970-01-01
    • 2019-04-04
    • 2023-04-04
    • 2017-11-18
    • 1970-01-01
    • 2019-12-08
    • 2019-01-07
    • 2022-07-15
    相关资源
    最近更新 更多