当我尝试从angular 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 update --all --force
它会产生一些小错误,例如
> Updates Angular Material to v8
Could not find TypeScript project for project: my-app-e2e
当我运行服务时,我会得到这个
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.
所以我有点困惑是什么原因导致的以及如何解决它。
答案 0 :(得分:2)
您需要做的不仅仅是命令更新,为避免错误,请遵循官方的升级建议,即:从7升级到8,然后从8升级到9,请遵循以下说明: {3}}