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

前端 未结 11 1480
予麋鹿
予麋鹿 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:46

    If you want to install/upgrade all packages to the latest version and you are running windows you can use this in powershell.exe:

    foreach($package in @("animations","common","compiler","core","forms","http","platform-browser","platform-browser-dynamic","router")) {
        npm install @angular/$package@latest -E
    }
    

    If you also use the cli, you can do this:

    foreach($package in @('animations','common','compiler','core','forms','http','platform-browser','platform-browser-dynamic','router', 'cli','compiler-cli')){
        iex "npm install @angular/$package@latest -E $(If($('cli','compiler-cli').Contains($package)){'-D'})";
    }
    

    This will save the packages exact (-E), and the cli packages in devDependencies (-D)

提交回复
热议问题