How to Install Angular 4 using Command Line Interface (CLI)


When it comes to the best framework in javascript AngularJs is the first name that most of the developers are using. Here is the full guide for how to install angular 4 using command line interface.

What is Angular JS?

AngularJS is a JavaScript-based open-source front web-application framework developed by Google for creating one-page web applications. Since it is a framework, it uses code templates and specific commands to perform special features such as filters and data-binding within HTML pages.

What is CLI?

A CLI (command line interface) is a user interface to a computer’s operating system in which user can type specific commands, received a response from the system, and then enters another command, and so on.

How to Install Angular 4 using Command Line Interface(CLI)

To install angular 4 using command line interface (CLI), you must have node.js installed on your machine. Here is the guide to install node.js in your machine.

    1. Install Angular CLI

First, check whether angular CLI is installed on your machine or not. To check that run following command.

  • ng -v:  This command will give you current angular CLI version

If  you have not install Angular CLI then proceed to next step:

  • npm install -g  @angular/cli: -g option will install angular CLI globally on your machine. You just have to run this command for the first time. Don’t worry about the warning that displays on the command line.

  • ng new my-new-app: This will create new project “my-new-app” under the specified directory. You can create a new project under specified directory by setting paths in the command line. This will take some time to download packages.

  • cd my-new-app: This will set the current path to the “my-new-app” directory.
  • ng -v: Now this command will give all entities associated with angular 4.

2. Go to URL (

Go to Installing RC.1 section

Copy and paste command for windows in the command line. If you are using Linux then you have to type a command that is associated with the Linux.


3. Installing Typescript.

Make sure that you are using typescript version 2.1.6 or higher. If not then you can type the following command to install typescript.

  • npm install typescript @2.2.1 –save: This will install typescript version 2.2.1 on your machine.

Now run ng -v to check typescript version

Run the following command to run the application:

  • Ng serve: This command will run your application in browser with URL localhost:4200

That’s it. Open your browser with URL localhost:4200 and your application is ready. If you any questions related to Installation in angular 4 then please let me know in the comment section. Happy coding 🙂


Please enter your comment!
Please enter your name here