angular - 升级到 angular9 问题 : Failed to find exported name of node

标签 angular npm angular9 angular-upgrade

升级到 Angular 9 并尝试运行我的项目后,我收到此错误:

Compiling @angular/common/http : module as esm5
Compiling angular-font-awesome : module as esm5
Compiling angular-font-awesome : module as esm5
Error: Error on worker #5: Error: Failed to find exported name of node (CommonModule = (function () {
    function CommonModule() {
    }
    return CommonModule;
}())) in 'C:/Users/.../node_modules/angular-font-awesome/dist/angular-font-awesome.es5.js'.
    at Object.findExportedNameOfNode (C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\find_export.js:35:19)
    at LogicalProjectStrategy.emit (C:\Users\Ghaida\...\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:228:38)
    at ReferenceEmitter.emit (C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:71:44)
    at Object.toR3Reference (C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\util.js:173:31)
    at NgModuleDecoratorHandler._toR3Reference (C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:415:31)
    at C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:196:72
    at Array.map (<anonymous>)
    at NgModuleDecoratorHandler.analyze (C:\Users\...\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:196:38)


这是运行 ng version 的结果:
Angular CLI: 9.1.0
Node: 10.15.0
OS: win32 x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.0
@angular-devkit/build-angular     0.901.0
@angular-devkit/build-optimizer   0.901.0
@angular-devkit/build-webpack     0.901.0
@angular-devkit/core              9.1.0
@angular-devkit/schematics        9.1.0
@angular/http                     7.2.16
@ngtools/webpack                  9.1.0
@schematics/angular               9.1.0
@schematics/update                0.901.0
rxjs                              6.5.4
typescript                        3.8.3
webpack                           4.42.0


PS:我运行'ng update'并得到'我们分析了你的package.json,一切似乎都井然有序。 '

最佳答案

问题解决移除后

  • 来自我的 package.json 的 angular-font-awesome
  • 来自 app.module.ts 的 AngularFontAwesomeModule

  • 并运行 npm install

    关于angular - 升级到 angular9 问题 : Failed to find exported name of node,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60950785/

    相关文章:

    javascript - 不输入指令

    javascript - 将 onclick 元素从一个数组移动到另一个数组。新数组对象中的内容为空/未复制?

    json - 调用函数 'makeDecorator' ,不支持函数调用

    javascript - 来自终端的 npm install 错误

    仅当启用 Ivy 时,Angular 9 升级才会导致 matPrefix 和 mat-form-field 出现样式问题

    javascript - 在 Angular 7 中填充对象模型

    angular - 在 Ionic2 应用程序中在哪里保存 API url 等设置?

    angular - 类型错误 : Invalid Event Target - But just by using direct Route

    javascript - 应用程序无法识别 Angular 9 中使用 Hammer.JS 和 HammerGestureConfig 的滑动

    angular9 - Angular 9 ng-pick-datetime 日期时间选择器未打开并给出错误