Angular, TypeScript and Nodejs: To Install and update by commands







I usually try to keep development environments updated to the latest versions. Because updates to either NodeJS, Angular, or TypeScript are continually being released, here I share the commands that generally work for me quickly and cleanly for these tasks.

The following instructions are presented to stay up-to-date with such updates. It is also a useful guide when you are first installing the development environment with these tools.



NodeJS and NPM
------------------------------------------------

1. To check the last version installed:

$ node -v
$ npm -v


2. If you want to install for the first time or  reinstall:

Download directly from the official site node.js org (for Mac it is not recommended to install with Homebrew), then check the node and npm version.

3. If you already installed node and npm and just want to update:

    - Using npm and n:
         
           //Clear caché
           $ sudo npm cache clean -f

           //Install n
           $ sudo npm install -g n

           //Install the last stable version
           $ sudo n stable

    - Manually:

           Download the last stable version from the official site node.js org and install it manually, then
           check the npm version (npm -v).

          Only if you need to update npm:

           $ sudo npm install npm@latest -g


       
TypeScript
------------------------------------------------

1. To check the last version installed:

$ tsc -v


2. If you want to install for the first time or  reinstall:

$ sudo npm install -g typescript


3. If you already installed and just want to update:

$ sudo npm update -g typescript

Note: If you receive a message like "npm ERR! asyncWrite is not a function" is because the latest version of node is not compatible yet with all npm modules. I recommend stable versions node like 8.11.3 or higher.

Angular CLI
------------------------------------------------

1. To check the last version installed:

$ ng --version


2. If you want to install for the first time or  reinstall:

$ sudo npm install -g @angular/cli


3. If you already installed and just want to update:

To follow the guide Updating Angular CLI

If you need to update the App, follow the next link: update angular

Previous
Next Post »
Thanks for your comment