Skip to content

Installing the Angular CLI

The Angular CLI (ng) is the command-line tool that creates projects, generates components, runs a dev server, and builds your app for production. You will use it constantly throughout this course.

The Angular CLI runs on Node.js. If you completed the TypeScript Foundations course, Node.js is already installed. Verify:

Terminal window
node --version
npm --version

Both commands should print version numbers. Node 18 or higher is required for Angular 21. If you need to install Node.js, download the LTS release from nodejs.org.

Install the Angular CLI globally so the ng command is available anywhere on your system:

Terminal window
npm install -g @angular/cli

Verify the installation:

Terminal window
ng version

You should see output like this:

_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 21.x.x
Node: 22.x.x
Package Manager: npm 10.x.x
OS: linux x64

The exact versions will differ. What matters is that the command runs without error.

The Angular CLI wraps a build system (webpack or esbuild depending on the version) and a code generation system. Its most important commands:

CommandWhat it does
ng new <name>Scaffold a new Angular project
ng serveStart the dev server with live reload
ng buildBuild the app for production
ng generate component <name>Generate a new component
ng generate service <name>Generate a new service

You will use all of these in this course. For now, just make sure the CLI is installed.

  1. Run npm install -g @angular/cli to install the CLI.
  2. Run ng version and confirm it prints the Angular CLI version without errors.
  3. Run ng help and scan the list of available commands. You do not need to understand them yet — just note which ones exist.
  • The Angular CLI is installed globally with npm install -g @angular/cli.
  • Verify with ng version — it should print the CLI and Node.js versions.
  • Node.js 18 or higher is required for Angular 21.
  • The CLI handles project scaffolding, code generation, the dev server, and production builds.