This article will help you understand how to properly install Angular on your machine or in the any of your productive environment. Before you go ahead and install angular CLI there are prerequisites that need to be installed.
Lets understand them in sequence.
You can install the following things in order for Angular to work:
- Download and Install Node.js from Nodejs.org.
- Verify the installation of Node and npm on your machine.
- Install Typescript using npm.
- Finally, Install Angular CLI using npm.
What is npm and CLI?
npm stands for Node Package Manager. npm is the place where you can find Java script libraries. The most famous one is Angular, jQuery, React and many others too. A great collection of libraries that you can use in your project.
Anyway, npm has Angular package so we install angular via npm tool.
CLI stands for Command Line Interface. CLI are nothing but simple commands that you type on command prompt like cmd / terminal to get the job done. Angular CLI means it is collection of command line tools that we use to build apps with Angular.
What Node.js has to do with Angular?
Node.js has nothing to do with Angular. Angular does not use Node. But we use the Node Package Manager (npm) installer that comes with Node.js to get the Angular package installed on our machine.
NPM is a great collection of libraries and angular is available here for us to install. So, to use npm we install Node.js
Step 1: Download and Install Node.js
Go to the Node.js main website – https://nodejs.org/en/ and download the stable version of Node and install on your local machine.
Step 2: Verify the installation of Node and npm
After you have completed installing the Node on your machine. Then next step is to verify if you can use it in the command prompt.
Verify Node is installed properly:
$ node -v
$ node -help
Verify npm is installed properly:
$ npm -version
$ npm -help
You get npm by default when you install Node.js installer. With the -help command line argument you can learn more about the additional arguments that you can pass to the node and npm.
Step 3: Install and Verify Typescript
Angular uses Typescript. So, You need to install TypeScript before using it in your Angular Project.
Install and Verify Typescript:
$ npm install –g typescript
$ tsc -version
$ tsc -help
-g option means that you are installing this package globally and it can accessed from anywhere.
Step 4: Install Angular CLI
After you have installed all the above dependencies then you can install Angular CLI using npm.
Install and Verify Angular CLI:
$ npm install –g @angular/cli
$ ng --version
$ ng --help
These are just the steps to install the Angular CLI, you can continue to browse about how to update the Angular CLI to latest version and how to create a sample application using Angular.