Angular 2 CLI Updated to 1.0
The Angular 2 CLI has been updated to 1.0! This new release is a big deal because we are finally out of the beta. I use the Angular 2 CLI tool every day so I wanted to update and then update my projects as quick as possible. So, if you are asking “what is Angular 2 CLI”; the answer is that it is a command line tool that helps developers work with Angular 2 projects. Angular 2 is the second version of a top front end framework for making web applications.
Upgrading Angular 2 CLI
First, make sure you are using at least Node 6.9.0. I use NPM so I was able to choose between upgrading my current node 6 version or installing a fresh ‘latest’ version of node. I updated to node 6.9.5 by installing the latest version of 6.
nvm install 6
Now you can remove the old version of the CLI using NPM. This is not a required step but was for me since I was using the beta.
npm uninstall -g angular-cli
Now you are ready to install Angular 2 CLI.
npm uninstall -g @angular/cli npm cache clean npm install -g @angular/cli@latest
Now you will have the latest version of NPM and you are ready to update your projects.
Upgrading an Existing Project
In order to update a project, there are a few steps, but first, remove the old version of angular 2 CLI and install the new. This has to be repeated in each project that you want to update.
npm uninstall --save-dev angular-cli rm -rf node_modules dist npm install --save-dev @angular/cli@latest npm install
If you are using yarn, you can use that to install as well, I found no problems doing so. At the end of this step, you will have the latest version of the CLI installed i your project and all your modules will be re-installed.
At this point, you have to reconfigure the project since there are a few changes that were made in the upgrade. I’m going to refer you to the official documentation here, https://github.com/angular/angular-cli/wiki/stories-rc-update#angular-clijson.
Good Luck!