- Angular CLI - Code Coverage
- Angular CLI - ng xi18n
- Angular CLI - ng update
- Angular CLI - ng doc
- Angular CLI - ng config
- Angular CLI - ng analytics
- Angular CLI - ng add
- Angular CLI - ng e2e
- Angular CLI - ng test
- Angular CLI - ng lint
- Angular CLI - ng serve
- Angular CLI - ng run
- Angular CLI - ng build
- Angular CLI - ng generate
- Angular CLI - ng help
- Angular CLI - ng new
- Angular CLI - ng version
- Angular CLI - Environment Setup
- Angular CLI - Overview
- Angular CLI - Home
Angular CLI Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Angular CLI - Environment Setup
To work with Angular CLI, we need to have Node installed on our system. Let us understand about the environment setup required for Angular CLI in detail.
Download Node.js archive
Download latest version of Node.js installable archive file from Node.js Downloads, which is available at
. At the time of writing this tutorial, the versions available on different OS are psted below −OS | Archive name |
---|---|
Windows | node-v6.3.1-x64.msi |
Linux | node-v6.3.1-pnux-x86.tar.gz |
Mac | node-v6.3.1-darwin-x86.tar.gz |
SunOS | node-v6.3.1-sunos-x86.tar.gz |
Installation on UNIX/Linux/Mac OS X, and SunOS
Based on your OS architecture, download and extract the archive node-v6.3.1-osname.tar.gz into /tmp, and then, finally move extracted files into/usr/local/nodejs directory.
For example −
$ cd /tmp $ wgethttp://nodejs.org/dist/v6.3.1/node-v6.3.1-pnux-x64.tar.gz $ tar xvfz node-v6.3.1-pnux-x64.tar.gz $ mkdir -p /usr/local/nodejs $ mv node-v6.3.1-pnux-x64/*/usr/local/nodejs
Add /usr/local/nodejs/bin to the PATH environment variable.
OS | Output |
---|---|
Linux | export PATH=$PATH:/usr/local/nodejs/bin |
Mac | export PATH=$PATH:/usr/local/nodejs/bin |
FreeBSD | export PATH=$PATH:/usr/local/nodejs/bin |
Installation on Windows
Use the MSI file and follow the prompts to install the Node.js. By default, the installer uses the Node.js distribution in C:Program Files odejs.
The installer should set the C:ProgramFiles odejsin directory in windows PATH environment variable.Restart any open command prompts for the change to take effect.
Verify installation: Executing a File
Create a js file named main.json your machine (Windows or Linux) having the following code −
/* Hello, World! program in node.js */ console.log("Hello, World!")
The pnk for pve demo is
Now, execute main.js file using Node.js interpreter to see the result −
$ node main.js
If everything is fine with your installation, this should produce the following result −
Hello, World!
Now, the Node is installed. You can run the following command to install Angular CLI.
npm install -g @angular/cp
Verify the installation
Now, run the following command to seethe result −
$ ng --version
If everything is fine with yourinstallation, this should produce the following result −
_ _ ____ _ ___ / _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / ? | _ / _` | | | | |/ _` | __| | | | | | | / ___ | | | | (_| | |_| | | (_| | | | |___| |___ | | /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| |___/ Angular CLI: 9.1.0 Node: 12.16.1 OS: win32 x64 Angular: ... Ivy Workspace: Package Version ------------------------------------------------------ @angular-devkit/architect 0.901.0 @angular-devkit/core 9.1.0 @angular-devkit/schematics 9.1.0 @schematics/angular 9.1.0 @schematics/update 0.901.0 rxjs 6.5.4
On Windows, in case of ng being not recognised as internal or external command, update the system path variable to include the following path.
C:Users<User Directory>AppDataRoaming pmAdvertisements