首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Angular 7升级到Angular 9失败

从Angular 7升级到Angular 9失败
EN

Stack Overflow用户
提问于 2020-05-12 07:55:41
回答 1查看 2.1K关注 0票数 0

当我尝试从angular 7升级到Angular 9时,我遇到了一堆问题。当我尝试进行ng更新时,我得到了以下错误。

代码语言:javascript
复制
 Package "@agm/core" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0 || ^7.0.0 || ^8.0.0", would install "9.1.6")
                  Package "@agm/core" has an incompatible peer dependency to "@angular/core" (requires "^6.0.0 || ^7.0.0 || ^8.0.0", would install "9.1.6")
                  Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "7.2.16" (extended), would install "9.1.6").
                  Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "7.2.16", would install "9.1.6")
                  Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.2.16", would install "9.1.6")
                  Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "7.2.16" (extended), would install "9.1.6").
                  Package "angular2-toaster" has an incompatible peer dependency to "@angular/common" (requires "^8.0.0", would install "9.1.6")
                  Package "angular2-toaster" has an incompatible peer dependency to "@angular/compiler" (requires "^8.0.0", would install "9.1.6")           Package "angular2-toaster" has an incompatible peer dependency to "@angular/core" (requires "^8.0.0", would install "9.1.6")
                  Package "bootstrap" has a missing peer dependency of "popper.js" @ "^1.16.0".
                  Package "igniteui-angular-charts" has an incompatible peer dependency to "@angular/common" (requires "^8.0.0", would install "9.1.6")
                  Package "igniteui-angular-charts" has an incompatible peer dependency to "@angular/compiler" (requires "^8.0.0", would install "9.1.6")
                  Package "igniteui-angular-charts" has an incompatible peer dependency to "@angular/core" (requires "^8.0.0", would install "9.1.6")
                  Package "igniteui-angular-core" has an incompatible peer dependency to "@angular/common" (requires "^8.0.0", would install "9.1.6")
                  Package "igniteui-angular-core" has an incompatible peer dependency to "@angular/compiler" (requires "^8.0.0", would install "9.1.6")
                  Package "igniteui-angular-core" has an incompatible peer dependency to "@angular/core" (requires "^8.0.0", would install "9.1.
                  Package "igniteui-angular-gauges" has an incompatible peer dependency to "@angular/common" (requires "^8.0.0", would install "
                  Package "igniteui-angular-gauges" has an incompatible peer dependency to "@angular/compiler" (requires "^8.0.0", would install
                  Package "igniteui-angular-gauges" has an incompatible peer dependency to "@angular/core" (requires "^8.0.0", would install "9.× Migration failed: Incompatible peer dependencies found.

然后当我运行ng update --all --force时

它会产生一些小错误,比如

代码语言:javascript
复制
> Updates Angular Material to v8
    Could not find TypeScript project for project: my-app-e2e

当我运行ng serve时,我得到以下结果

代码语言:javascript
复制
Warning: Entry point 'ng2-slim-loading-bar' contains deep imports into 'C:/Users/DevSys/Documents/GitHub/Angular-CRM/Angular-7-CRM/node_modules/rxjs/Observable'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Compiling @angular/core : module as esm5
Compiling @angular/cdk/keycodes : module as esm5
Compiling @angular/animations : module as esm5
Compiling @angular/compiler/testing : module as esm5
Compiling @angular/cdk/observers : module as esm5
Compiling @angular/common : module as esm5
Compiling @angular/animations/browser : module as esm5
Compiling @angular/cdk/collections : module as esm5
Compiling @angular/core/testing : module as esm5
Compiling @angular/cdk/accordion : module as esm5
Compiling ag-grid-angular : module as esm5
Compiling @angular/cdk/platform : module as esm5
Compiling @angular/platform-browser : module as esm5
Compiling angular-font-awesome : module as esm5
Compiling @angular/cdk/bidi : module as esm5
Compiling @angular/forms : module as esm5
Compiling @angular/cdk/portal : module as esm5
Compiling @angular/cdk/a11y : module as esm5
Compiling @angular/platform-browser/animations : module as esm5
Compiling @angular/cdk/scrolling : module as esm5
Compiling @angular/common/http : module as esm5
Error: Error on worker #7: Error: Failed to find exported name of node (CommonModule = (function () {
    function CommonModule() {
    }
    return CommonModule;
}())) in 'C:/Users/DevSys/Documents/GitHub/Angular-CRM/Angular-7-CRM/node_modules/angular-font-awesome/dist/angular-font-awesome.es5.js'. 
    at Object.findExportedNameOfNode (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\find_export.js:35:19)
    at LogicalProjectStrategy.emit (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:228:38)
    at ReferenceEmitter.emit (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:71:44)
    at Object.toR3Reference (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\util.js:192:31)
    at NgModuleDecoratorHandler._toR3Reference (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:417:31)
    at C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:197:72
    at Array.map (<anonymous>)
    at NgModuleDecoratorHandler.analyze (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:197:38)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:345:40)
    at analyze (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:297:58)
    at ClusterMaster.onWorkerMessage (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:194:27)
    at C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:54:95
    at ClusterMaster.<anonymous> (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:292:57)
    at step (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\tslib\tslib.js:139:27)
    at Object.next (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\tslib\tslib.js:120:57)
    at C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\tslib\tslib.js:113:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\tslib\tslib.js:109:16)
    at EventEmitter.<anonymous> (C:\Users\DevSys\Documents\GitHub\Angular-CRM\Angular-7-CRM\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:286:32)
    at EventEmitter.emit (events.js:210:5)
An unhandled exception occurred: NGCC failed.

所以我有点困惑是什么导致了这个问题,以及如何修复它。

EN

回答 1

Stack Overflow用户

发布于 2020-05-12 08:48:36

有一些更新你需要做的不仅仅是一个命令,所以为了避免错误,遵循官方的升级建议:从7升级到8,然后从8升级到9,遵循以下说明:https://update.angular.io/#7.0:9.0

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61741414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档