从 Angular 7 升级到 Angular 9 失败



我在尝试从角度 7 升级到 Angular 9 时遇到了一堆问题。当我尝试进行ng更新时--所有错误都出现以下错误。

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 更新时 --all --force

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

> Updates Angular Material to v8
Could not find TypeScript project for project: my-app-e2e

当我运行 ng 服务时,我得到这个

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:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscimportssrcfind_export.js:35:19)
at LogicalProjectStrategy.emit (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscimportssrcemitter.js:228:38)
at ReferenceEmitter.emit (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscimportssrcemitter.js:71:44)
at Object.toR3Reference (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscannotationssrcutil.js:192:31)
at NgModuleDecoratorHandler._toR3Reference (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscannotationssrcng_module.js:417:31)
at C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscannotationssrcng_module.js:197:72
at Array.map (<anonymous>)
at NgModuleDecoratorHandler.analyze (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtscannotationssrcng_module.js:197:38)
at NgccTraitCompiler.TraitCompiler.analyzeTrait (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtsctransformsrccompilation.js:345:40)
at analyze (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clisrcngtsctransformsrccompilation.js:297:58)
at ClusterMaster.onWorkerMessage (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clingccsrcexecutionclustermaster.js:194:27)
at C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clingccsrcexecutionclustermaster.js:54:95
at ClusterMaster.<anonymous> (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clingccsrcexecutionclustermaster.js:292:57)
at step (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modulestslibtslib.js:139:27)
at Object.next (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modulestslibtslib.js:120:57)
at C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modulestslibtslib.js:113:75
at new Promise (<anonymous>)
at Object.__awaiter (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modulestslibtslib.js:109:16)
at EventEmitter.<anonymous> (C:UsersDevSysDocumentsGitHubAngular-CRMAngular-7-CRMnode_modules@angularcompiler-clingccsrcexecutionclustermaster.js:286:32)
at EventEmitter.emit (events.js:210:5)
An unhandled exception occurred: NGCC failed.

所以我有点困惑是什么原因造成的以及如何解决它。

您需要执行的一些更新不仅仅是一个命令,因此为避免错误,请遵循官方升级建议,其中说:按照以下说明从 7 升级到 8,然后从 8 升级到 9:https://update.angular.io/#7.0:9.0

最新更新