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

Categories

0 votes
1.1k 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 Answer

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/[email protected]. 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...