How to Install Angular 10 CLI via NPM

  • 2020-04-22 07:57 AM
  • 327

Learn how to install Angular 10 CLI using the node package manager (NPM) and create an Angular 10 project with routing.

Angular 10 beta is released so the final release is due soon. Let’s see how to install the latest beta version and create a new project.

Step 1 — Installing Angular CLI 10

Let’s start by installing Angular CLI 10 in our development machine.

Note: At this time, Angular 10 is in beta.

Angular CLI 10

Head over to a new terminal and run the following command:

$ npm install --global @angular/[email protected]

This will install @angular/[email protected] at the time of writing this tutorial.

That’s it of everything goes as expected you should have Angular 10 CLI installed on your system.

Step 2 — Initializing a New Angular 10 Project

In our second step, we’ll use Angular CLI to create our example project. Go back to your terminal and run the following commands:

$ cd ~
$ ng new angular10-example

You’ll get asked if Would you like to add Angular routing? -> y and Which stylesheet format would you like to use? -> CSS.

This will automatically add routing to our project and set up CSS for styling components.

Next, navigate to your project’s directory and run the local development server using the following commands:

$ cd angular10-example
$ ng serve    

You’ll be able to visit your Angular app from thehttp://localhost:4200/ address in your web browser.