【发布时间】:2021-05-02 05:49:36
【问题描述】:
我有一个 Angular 9 应用程序,现在已升级到 Angular 11。 现在在编译 Angular 应用程序时,我遇到了错误。
Compiling @angular/material/core : es2015 as esm2015
Compiling @angular/cdk/scrolling : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Error: Error on worker #2: TypeError: Cannot read property 'map' of null
at ComponentDecoratorHandler.analyze (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\component.js:210:79)
at NgccTraitCompiler.TraitCompiler.analyzeTrait (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:346:40)
at analyze (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:298:58)
at _loop_1 (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:320:21)
at NgccTraitCompiler.TraitCompiler.analyzeClass (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:326:35)
at NgccTraitCompiler.analyzeFile (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\analysis\ngcc_trait_compiler.js:48:26)
at DecorationAnalyzer.analyzeProgram (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\analysis\decoration_analyzer.js:140:39)
at Transformer.analyzeProgram (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\packages\transformer.js:130:57)
at Transformer.transform (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\packages\transformer.js:76:27)
at C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\execution\create_compile_function.js:49:42
at ClusterMaster.onWorkerMessage (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:195:27)
at C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:55:95
at ClusterMaster.<anonymous> (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:293:57)
at step (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\tslib\tslib.js:143:27)
at Object.next (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\tslib\tslib.js:124:57)
at C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\tslib\tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\tslib\tslib.js:113:16)
at EventEmitter.<anonymous> (C:\Users\RJhaveri\Documents\Ronak\SourceCode\Development\SNSConversionAutomation\sns-conversion\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:287:32)
at EventEmitter.emit (events.js:321:20)
请建议如何解决此问题。
【问题讨论】:
-
你也升级了棱角材料吗? Angular 建议从 9、10、11 逐步升级。你使用了 Angular 升级 cli 吗?
-
不,我已将应用程序从 9 升级到 11。我相信这是应用程序无法编译的原因。有什么办法吗?
-
你是用angular cli升级的吗?
-
是的,升级是使用 Angular cli 完成的