How to Install Angular 2 using CLI on Windows 7 Machine
Install Angular 2 in 7 steps using Angular-CLI on Windows 7 machine
Angular 2 is one framework for mobile and desktop. This article teaches you how to install Angular-cli on Windows 7. At the end of reading, you will learn how to create Angular 2 project using Angular-cli. The instructions below help you create new Angular 2 project folder; install dependencies; and start a development server. To install on Windows 7 follow the below steps:
1.Install latest version Nodejs (Node version 6) if you do not already have it on your machine. Right click command prompt and choose run as Administrator. When Nodejs is installed, npm (Node Package Manager) is installed along. To check nodejs version and npm version-:
c:/>node -v
c:/>npm -v.
2. Change the environment variable to the location where npm is installed on your machine e.g. “C:\Users\myprofile\AppData\Roaming\npm”. Click start button in taskbar and type ‘env’ in search field. Click environment variable. Environment variable dialog box displayed. Click PATH in User variable section and then edit button. Enter ; if not already present and then path e.g. C:\Users\myprofile\AppData\Roaming\npm . Then click ok.
; act as a separator between path variables
3. Install angular-cli as administrator. Right click command prompt application and click run as administrator.
c:/> npm install -g angular-cli
- g stands for install globally
Open new command prompt and enter : c:/> ng version
If it runs properly and displays angular 2 version. Everything installed fine. Go to step 5 else step 4 if you get “Cannot find “reflect-metadata” .
4. Install reflect-metadata as administrator
c:/>npm install -g reflect-metadata
5. ng version
6. ng new FirstAngular2App
This will take few minutes to initialize and install dependencies
7. Run your FirstAngular2App
Change directory to FirstAngular2App
c:/cd FirstAngular2App>
c:/cd FirstAngular2App> ng serve
Enter http://localhost:4200 to view your app
Thank you for reading. Please feel free to leave comment(s).
Resources:
- Angular 2 officail website: https://angular.io
- Angular-cli github repo: https://github.com/angular/angular-cli