Home / Angular / How to Install Angular 5 (Tutorial)

How to Install Angular 5 (Tutorial)

I feel like people are not understanding that Angular 5 is not a new framework nor was 4. There are very few changes on the surface, it is just semantic versioning. Its all just “Angular”, just like we do not say React 16. There are only 2 different frameworks and that is AngularJS (Version 1) and Angular. Everything you know about Angular 2 applies to 4,5 and 6+ when it is released. So saying “I just learned Angular 4” makes NO sense. Angular 5 is Angular 4 with a few improvements mostly under the hood, making it faster. I don’t mean to sound like a prick but I see the same dumb comments over and over and if they just took a second to look get informed they would get it 🙂

However, if you have no previous experience with Angular, don’t worry — installing Angular 5 is a breeze. So, let’s get started.

Prerequisites
You’re going to need a couple things before proceeding:

Node.js
Node Package Manager (NPM)
To check whether or not you have both of these installed, visiting your command line or console and type:

$ node -v
$ npm -v

If either of these commands is unrecognized, visit the downloads section of Nodejs.org and download/run the appropriate installer based on your OS.

Follow the installation steps with default settings, which will install NPM by default. Once finished, reload your command line/console and retype the above commands — they should now give you version numbers.

Installing Angular 5 through the CLI

The Angular CLI (Command Line Interface) is the quickest and easiest way to get started with a brand new Angular 5 project.

We’re going to use NPM (you can also use yarn) to install the Angular CLI through the following command:

$ npm install @angular/cli -g

Want to install the specific ng version read the article ” How to Install a specific version of ng cli ”

Once installed, you can access the CLI tool by typing ng.

To check the version of your Angular CLI, type:

$ ng -v
Angular CLI: 1.5.0
Node: 6.10.0
OS: win32 x64
Angular:
...

As you can see, mine is currently at version 1.5.0. Great, now we’re ready to use the CLI to start the project.

To install Angular 5 through the CLI, type:

$ ng new my-new-project --style=scss --routing

The two flags we added at the end specify that we want the CSS to use the Sass compiler, and –routing tells the CLI to provide us with the routing scaffolding.

It will run for awhile and then prompt you that you can cd into the new project folder. To do that, simply type:

$ cd my-new-project

To serve your project in the browser, which is useful for development as it automatically compiles your project and reloads it in the browser, type:

$ ng serve

And that’s it! You have a fresh copy of Angular 5 ready and waiting for you to develop.

In Next Tutorial “Angular 5 Components Tutorial” we are going to see how to generate the component using angular CLI.

About Mohammad Fareed

Software Engineer @ Tekzenit.

Check Also

What’s new In Angular 5? What Is the Difference Between Angular 4 and Angular 5?

Angular, one of the best open-source JavaScript frameworks for web application development, recently upgraded with …

Leave a Reply

Your email address will not be published. Required fields are marked *