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
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.
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.
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
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.