ng update从不更新@ angular/core版本 [英] ng update never updates @angular/core version
问题描述
我运行命令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
所以我运行ng update @angular/core
并显示Package '@angular/core' is already up to date.
如何解决此问题?
so I run ng update @angular/core
and it says Package '@angular/core' is already up to date.
How can I resolve this issue?
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
我需要@angular/core@9.1.0
,所以我可以将TypeScript 3.8.3
与ng serve
一起使用,因为如果没有它,我目前会遇到类似以下的错误:error TS2314: Generic type 'ɵɵFactoryDef' requires 2 type argument(s).
.
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).
.
我尝试使用--force
选项删除并重新安装node_modules
,指定版本@angular/core@9.1.0
,但无济于事.
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.
推荐答案
我遵循了 ng update
现在显示We analyzed your package.json and everything seems to be in order. Good work!
npm ls @angular/core
向我展示了此内容:
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
所以我将package.json
中的所有9.0.7
替换为9.1.0
,然后npm i
并解决了我的问题!
So I replace all of 9.0.7
in package.json
with 9.1.0
, then npm i
and my issues are resolved!
更新@angular/core
时,似乎所有其他@angular
软件包都必须具有相同的版本,无论是否使用^
.
When you update @angular/core
, it seems that all other @angular
packages need to have the same version, regardless of ^
being used or not.
这篇关于ng update从不更新@ angular/core版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!