Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Installing Angular CLI

Suggested Videos
Part 1 - What is Angular CLI | Text | Slides

In this video we will discuss how to install Angular CLI

Prerequisites for installing Angular CLI : To install Angular CLI you should have installed Node 6.9.0 or higher, and NPM 3 or higher


To check the versions that you have on your machine type the following commands in a command window.
  • node -v 
  • npm -v

You can get the latest version of Node and NPM from the following website. Click on the correct download link depending on the Operating System you have.
https://nodejs.org/en/download/

Once you have Node and NPM installed. Run Command Prompt as an administrator and execute the following command. Flag -g installs Angular CLI globally on your machine.
npm install -g @angular/cli

You can also use i as shortcut for install. So the above command can also be rewritten as shown below
npm i -g @angular/cli

If you see a tree structure as shown below, you have Angular CLI installed successfully. 
install angular cli on windows 10

To verify the version of Angular CLI installed, execute the following command
ng -v

At the time of this recording, I have Angular CLI version 1.4.2 installed on my machine as you can see from the screenshot below.
angular cli setup

If you run into any problems installing Angular CLI, follow these steps and hopefully Angular CLI will be installed successfully.

Step 1 : Delete "npm" folder from the following path
C:\Users\Your_UserName\AppData\Roaming

Please note : If you cannot find "AppData" folder, make sure in your windows operating system, you have "Show hidden files, folders, and drives" option is turned on. "AppData" is a hidden folder.

Step 2 : Once you have the "npm" folder deleted, uninstall node.js. On a windows machine you can uninstall node.js from Control Panel\All Control Panel Items\Programs and Features. Right click on "Node.js" and select "uninstall" from the context menu.

Step 3 : Reinstall Node.js by downloading the appropriate installer for your operating system from the following link.
https://nodejs.org/en/download/

Step 4 : Run Command Prompt as an Administrator and try to install Angular CLI again using the following command. Hopefully this time it installs successfully. If not, please leave the problem you are facing as a comment on this video and we will try to help as soon as we can. Also, if you had a problem and you solved it yourself, please let us know what the problem is and how you solved it by leaving a comment, so it could help others with a similar problem. After all, it's all about sharing and learning from each other.
npm install -g @angular/cli

In our next video, we will discuss creating an Angular project from scratch using Angular CLI.

angular cli tutorial for beginners

3 comments:

  1. Getting error when installing angular
    'ng' is not recognized as an internal or external command,
    operable program or batch file.even after the node and npm versions checked

    ReplyDelete
  2. After node 13.0 ,ng -v is replaced by ng --verison

    ReplyDelete
  3. we can type ng v instead of ng -v

    ReplyDelete

It would be great if you can help share these free resources