Angular – Installation
To install Angular, follow these steps:
1. Prerequisites
- Node.js and npm:
- Ensure that Node.js (v14.20.0 or later) and npm (v6.14.15 or later) are installed on your system.
- Check versions:
PS D:\AngularProject> node -v
v22.11.0
PS D:\AngularProject> npm -v
10.9.0
PS D:\AngularProject>
- Download and install from Node.js official website if not installed.
- Also click here to know, how to install node.js
2. Install Angular CLI
The Angular CLI (Command Line Interface) is a tool to create, build, and manage Angular applications.
- Run the following command in your terminal to install Angular CLI globally:
npm install -g @angular/cli
- Verify installation:
ng version
3. Create a New Angular Project
- Use the Angular CLI to create a new project:
ng new project-name
- During setup, you’ll be prompted to:
- Add Angular routing (Yes or No).
- Choose a stylesheet format (CSS, SCSS, etc.).
- Navigate to the project directory:
cd project-name
4. Serve the Application
- Start a development server:
ng serve
- Open your browser and go to http://localhost:4200
5. Update Angular CLI (Optional)
- If you want to update Angular CLI to the latest version:
npm install -g @angular/cli@latest
6. Common CLI Commands
- Check installed version:
ng version
- Generate components, services, or modules:
ng generate component component-name
ng generate service service-name
ng generate module module-name
- Build the application for production:
ng build --prod
You’re now ready to start developing with Angular!
PS D:\AngularProject> node -v
v22.11.0
PS D:\AngularProject> npm -v
10.9.0
PS D:\AngularProject> npm install -g @angular/cli@latest
changed 296 packages in 8s
52 packages are looking for funding
run `npm fund` for details
PS D:\AngularProject> npm config get prefix
C:\Users\Anuj\AppData\Roaming\npm
set this path in OS Environment
PS C:\Users\Anuj> ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.0.2
Node: 22.11.0
Package Manager: npm 10.9.0
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1900.2 (cli-only)
@angular-devkit/core 19.0.2 (cli-only)
@angular-devkit/schematics 19.0.2 (cli-only)
@schematics/angular 19.0.2 (cli-only)
PS C:\Users\Anuj>
PS D:\AngularProject> ng new insurance-project
Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.dev/cli/analytics.
yes
Thank you for sharing pseudonymous usage data. Should you change your mind, the following
command will disable this feature entirely:
ng analytics disable --global
Global setting: enabled
Local setting: No local workspace configuration file.
Effective status: enabled
√ Which stylesheet format would you like to use? CSS [ https://developer.mozilla.org/docs/Web/CSS
]
√ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? yes
√ Would you like to use the Server Routing and App Engine APIs (Developer Preview) for this server application? yes
CREATE insurance-project/angular.json (2890 bytes)
CREATE insurance-project/package.json (1296 bytes)
CREATE insurance-project/README.md (1538 bytes)
CREATE insurance-project/tsconfig.json (942 bytes)
CREATE insurance-project/.editorconfig (331 bytes)
CREATE insurance-project/.gitignore (629 bytes)
CREATE insurance-project/tsconfig.app.json (508 bytes)
CREATE insurance-project/tsconfig.spec.json (449 bytes)
CREATE insurance-project/.vscode/extensions.json (134 bytes)
CREATE insurance-project/.vscode/launch.json (490 bytes)
CREATE insurance-project/.vscode/tasks.json (980 bytes)
CREATE insurance-project/src/main.ts (256 bytes)
CREATE insurance-project/src/index.html (315 bytes)
CREATE insurance-project/src/styles.css (81 bytes)
CREATE insurance-project/src/main.server.ts (271 bytes)
CREATE insurance-project/src/server.ts (1674 bytes)
CREATE insurance-project/src/app/app.component.html (20239 bytes)
CREATE insurance-project/src/app/app.component.spec.ts (978 bytes)
CREATE insurance-project/src/app/app.component.ts (305 bytes)
CREATE insurance-project/src/app/app.component.css (0 bytes)
CREATE insurance-project/src/app/app.config.ts (447 bytes)
CREATE insurance-project/src/app/app.routes.ts (80 bytes)
CREATE insurance-project/src/app/app.config.server.ts (519 bytes)
CREATE insurance-project/src/app/app.routes.server.ts (174 bytes)
CREATE insurance-project/public/favicon.ico (15086 bytes)
√ Packages installed successfully.
warning: in the working copy of 'package-lock.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'package.json', LF will be replaced by CRLF the next time Git touches it
Successfully initialized git.
PS D:\AngularProject>
PS D:\AngularProject> dir
Directory: D:\AngularProject
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 01-12-2024 11:18 insurance-project
PS D:\AngularProject> cd .\insurance-project\
PS D:\AngularProject\insurance-project>
PS D:\AngularProject\insurance-project> ng serve
Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.dev/cli/analytics.
yes
Thank you for sharing pseudonymous usage data. Should you change your mind, the following
command will disable this feature entirely:
ng analytics disable
Global setting: enabled
Local setting: enabled
Effective status: enabled
Browser bundles
Initial chunk files | Names | Raw size
polyfills.js | polyfills | 90.20 kB |
main.js | main | 18.32 kB |
styles.css | styles | 95 bytes |
| Initial total | 108.61 kB
Server bundles
Initial chunk files | Names | Raw size
polyfills.server.mjs | polyfills.server | 572.91 kB |
main.server.mjs | main.server | 19.55 kB |
server.mjs | server | 1.86 kB |
Application bundle generation complete. [7.621 seconds]
Watch mode enabled. Watching for file changes...
NOTE: Raw file sizes do not reflect development server per-request transformations.
➜ Local: http://localhost:4200/
➜ press h + enter to show help
You will get below page
Recent Comments