Installing the Angular CLI
The Angular CLI is the command-line tool you use to create, develop, build, and test Angular applications. It scaffolds projects with sensible defaults, runs a fast dev server, and wires up the build pipeline so you can focus on writing components instead of configuring tooling. Before you can install it, you need a supported version of Node.js, which ships with the npm package manager used to download the CLI. This page walks through installing Node.js, installing the CLI globally, verifying everything works, and understanding version compatibility.
Install Node.js and npm
The Angular CLI runs on Node.js and is distributed through npm, so install Node first. Each major Angular release supports a specific range of Node.js versions, and using an unsupported version is the most common cause of confusing install errors. Always pick an active LTS (Long-Term Support) release.
Download the LTS installer from nodejs.org, or use a version manager such as nvm so you can switch between Node versions per project.
# Using nvm (recommended for managing multiple versions)
nvm install --lts
nvm use --lts
Once installed, confirm both Node.js and npm are on your PATH:
node --version
npm --version
Output:
v20.11.1
10.2.4
Tip: Angular 17 and 18 require Node.js 18.13+ or 20.9+, and Angular 19 requires Node.js 18.19+, 20.11+, or 22.0+. Odd-numbered Node releases (19, 21) are not LTS and are not supported — stick to even-numbered LTS lines.
Install the Angular CLI globally
With npm available, install the CLI globally so the ng command is accessible from any directory. The -g flag installs the package system-wide rather than into a single project.
npm install -g @angular/cli
To install a specific major version — useful when a project pins a particular Angular release — append the version tag:
# Install the latest 18.x CLI
npm install -g @angular/cli@18
# Install an exact version
npm install -g @angular/[email protected]
Warning: On macOS and Linux, avoid
sudo npm install -g. It installs packages as root and frequently causes permission errors later. Instead, configure npm to use a user-owned global directory, or use nvm, which sidesteps the problem entirely.
Verify the installation
After installation, run ng version to confirm the CLI is wired up correctly. This command prints the CLI version, the Angular framework packages, and the Node.js and package-manager versions it detected — a quick health check of your whole toolchain.
ng version
Output:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.2.0
Node: 20.11.1
Package Manager: npm 10.2.4
OS: linux x64
If you run ng version inside an Angular project, it additionally lists the installed framework packages (@angular/core, @angular/router, and so on) and their versions.
The first time you run any ng command, the CLI may ask whether to share anonymous usage analytics. You can answer the prompt interactively or disable analytics globally:
ng analytics disable --global
Understanding CLI version compatibility
There are two distinct versions to keep straight: the globally installed CLI (the ng binary on your PATH) and the project-local CLI stored in each project’s node_modules. When you run ng inside a project, the CLI delegates to the project-local version so commands always match that project’s Angular release.
| Concern | Global CLI | Local CLI (per project) |
|---|---|---|
| Location | npm global folder | node_modules/@angular/cli |
| Purpose | Scaffolding new projects with ng new | Building, serving, and testing an existing project |
| Updated by | npm install -g @angular/cli@latest | ng update @angular/cli @angular/core |
| Version match | Should be recent | Must match @angular/core major version |
Because the local CLI takes over inside a project, your global CLI does not need to exactly match every project. Keep the global CLI reasonably current for ng new, and use ng update to migrate a project’s local Angular packages safely:
ng update @angular/cli @angular/core
Tip:
ng updatedoesn’t just bump version numbers — it runs migration schematics that automatically refactor your code for breaking changes between major versions. Always run it on a clean Git working tree so you can review the changes.
Best Practices
- Use an active LTS version of Node.js and verify it falls within your Angular release’s supported range before installing.
- Prefer a version manager like nvm over a system-wide Node install so you can match Node versions to projects.
- Never use
sudofor global npm installs; configure a user-owned global prefix or rely on nvm to avoid permission issues. - Pin the CLI version (
@angular/cli@19) when onboarding to a team project so everyone scaffolds with the same tooling. - Run
ng versionafter installing and when troubleshooting to confirm the CLI, Node, and framework versions all line up. - Upgrade projects with
ng updaterather than editingpackage.jsonby hand, and commit first so the migration diff is reviewable.