Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

angular - ng update to specific version

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 ng update docs 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...