How do I correctly upgrade angular 2 (npm) to the latest version?

前端 未结 11 1434
予麋鹿
予麋鹿 2020-11-28 00:47

Recently I started Angular 2 tutorial at https://angular.io/docs/ts/latest/tutorial/.

and left off with Angular 2 beta 8. Now I resumed the tutorial and latest beta

11条回答
  •  渐次进展
    2020-11-28 01:26

    Official npm page suggest a structured method to update angular version for both global and local scenarios.

    1.First of all, you need to uninstall the current angular from your system.

    npm uninstall -g angular-cli
    npm uninstall --save-dev angular-cli
    npm uninstall -g @angular/cli
    

    2.Clean up the cache

    npm cache clean
    

    EDIT

    As pointed out by @candidj

    npm cache clean is renamed as npm cache verify from npm 5 onwards

    3.Install angular globally

    npm install -g @angular/cli@latest
    

    4.Local project setup if you have one

    rm -rf node_modules
    npm install --save-dev @angular/cli@latest
    npm install
    

    Please check the same down on the link below:

    https://www.npmjs.com/package/@angular/cli#updating-angular-cli

    This will solve the problem.

提交回复
热议问题