How to Install Angular CLI for Local Development
In this tutorial, I am going to tell you how to install Angular CLI step by step and create our first Angular project.
To create the development environment on your system, you need Node.js, npm package manager and typescript. We have to install these step by step.
At first, we need Node.js installed in our system. So you have to download Node.js from the official website which is https://nodejs.org. After you visit Node.js official website, you will able to see two download options for Windows. one is “Recommended For Most Users” and the other one is “Latest Features”.
I recommend you to download the recommended version of Nodejs. After you download it, you will get the installer file of Nodejs. You just have to install it on your system. After the installation complete you have to open the command prompt.
Press “Windows+R”, then type cmd and click “ok” just like you can see below:
After that, the command prompt window will be open.
To confirm if Nodejs installed properly on your system or not, below is the command:
The above command will return the version of Node.js that is installed in your system just like you can see below:
Install npm package manager
You don’t need to install npm package manager. It has already come with Node.js. During the installation of Node.js, the npm package manager also installed.
Below is the command to Get the TypeScript:
npm install -g typescript
Finally, Install Angular CLI and create your first Angular project
Now the environment has been created to install the Angular in the system. Below is the command that will install the Angular CLI:
npm install -g @angular/cli
Now to be confirmed, you can check the version of Angular CLI and it’s packages with the command below:
It will show what you can see oin the picture below:
Now let’s create your first Angular project.
ng new ngtutorial
Now its time to run your project. Below is the command that will create the server for your project:
That’s it. Now you can open your project on your browser. It already has the 4200 port with localhost. So to open your project go to http://localhost:4200/ .
That’s it. We have installed the Angular CLI in our system and created our first project from the command prompt.