Issue
I run the command ng update
We analyzed your package.json, there are some packages to update:
Name Version Command to update
-----------------------------------------------------------------------------------
@angular/core 9.0.7 -> 9.1.0 ng update @angular/core
so I run ng update @angular/core and it says Package '@angular/core' is already up to date. How can I resolve this issue?
ng v
Angular CLI: 9.1.0
Node: 13.9.0
OS: win32 x64
Angular: 9.1.0
... cli, core, forms, localize
Ivy Workspace: Yes
Package Version
-------------------------------------------------------------
@angular-devkit/architect 0.900.7
@angular-devkit/build-angular 0.900.7
@angular-devkit/build-optimizer 0.900.7
@angular-devkit/build-webpack 0.900.7
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@angular/animations 9.0.7
@angular/common 9.0.7
@angular/compiler 9.0.7
@angular/compiler-cli 9.0.7
@angular/language-service 9.0.7
@angular/platform-browser 9.0.7
@angular/platform-browser-dynamic 9.0.7
@angular/router 9.0.7
@ngtools/webpack 9.0.7
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.4
typescript 3.8.3
webpack 4.41.2
I need @angular/core@9.1.0 so I can use TypeScript 3.8.3 with ng serve because I am currently getting errors like these without it: error TS2314: Generic type 'ɵɵFactoryDef' requires 2 type argument(s)..
I have tried deleting and reinstalling node_modules, using the --force option, specifying the version @angular/core@9.1.0, all but to no avail.
Solution
I followed the steps from this website, but for @angular/core:
npm uninstall @angular/core
npm cache verify
npm install @angular/core@latest
ng update now shows We analyzed your package.json and everything seems to be in order. Good work!
npm ls @angular/core showed me this:
C:\Users\jsmith\AppData\Roaming\npm
`-- UNMET PEER DEPENDENCY @angular/core@9.1.0
npm ERR! peer dep missing: @angular/core@9.0.7, required by @angular/forms@9.0.7
So I replace all of 9.0.7 in package.json with 9.1.0, then npm i and my issues are resolved!
When you update @angular/core, it seems that all other @angular packages need to have the same version, regardless of ^ being used or not.
Answered By - xinthose