ng更新到特定的Angular版本 [英] ng update to specific Angular version

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

问题描述

我想将Angular从5.0版更新到6.1版. https://update.angular.io/上的说明建议使用ng update @angular/core进行更新.但这会直接更新到版本7,而不是版本6.

ng update的文档建议使用--to将更新到特定版本.但是,这似乎不起作用.使用的确切命令是:ng update @angular/core --to 6.1.0但这将更新为7.0.0

我尝试使用--from=5.0.0 --to=6.1.9,但这没有用.我注意到我们正在使用angular-cli版本1.6.4.此版本支持--next,根据文档,该版本应为(Default: false) Install the next version, instead of the latest..但这会将package.json更改为使用所有@angular/*软件包的版本7.0.0

解决方案

在此处添加此内容,因为它出现在搜索结果中,并且此处提供的答案对我不起作用.

对我有用的是使用ng update @angular/core@7.0.0.这可能应该在《 Angular更新指南》( https://update.angular.io/)中加以说明,但是它不是.由于在一次跨多个主要版本升级时,该页面会发出通知,但使用推荐的命令ng update @angular/core升级到最新版本(可能跨多个主要版本),因此可能应对此进行更改.

I would like to update Angular from version 5.0 to version 6.1. The instructions at https://update.angular.io/ suggest using ng update @angular/core to update. However this updates directly to version 7 instead of version 6.

The docs of ng update it suggest that using --to would update to a specific version. However this does not seem to work. The exact command used is: ng update @angular/core --to 6.1.0 But this updates to 7.0.0

EDIT:

I've tried using --from=5.0.0 --to=6.1.9 but this didn't work. I've noticed we're stil using angular-cli version 1.6.4. This version supports --next which according to the docs should (Default: false) Install the next version, instead of the latest. However this changes the package.json to use version 7.0.0 of all @angular/* packages

解决方案

Adding this here, since this comes up in search results and the answers provided here didn't work for me.

What worked for me was using ng update @angular/core@7.0.0. This should probably be noted in the Angular Update Guide (https://update.angular.io/), but it's not. Since that page throws a notice up when upgrading across more than one major version at a time, but using the recommended command ng update @angular/core upgrades to the latest release (which could be across more than one major version), perhaps this should be changed.

这篇关于ng更新到特定的Angular版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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