ng update 从不更新@angular/core 版本 [英] ng update never updates @angular/core version

查看:30
本文介绍了ng update 从不更新@angular/core 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行命令 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' 已经是最新的. 我该如何解决这个问题?

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.3ng serve 因为我目前得到没有它的错误:error TS2314: Generic type 'ɵɵFactoryDe​​f' requires 2 type arguments(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)..

我尝试删除并重新安装 node_modules,使用 --force 选项,指定版本 @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.

推荐答案

我按照这个网站,但对于@angular/core:

npm uninstall @angular/core
npm cache verify
npm install @angular/core@latest

ng update 现在显示 我们分析了您的 package.json,一切似乎都井井有条.干得好!

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

所以我用 9.1.0 替换了 package.json 中的所有 9.0.7,然后 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆