How to Update Angular CLI to the Latest Version: A Complete Guide

To update Angular CLI to the latest version, uninstall the current global package and reinstall using npm install -g @angular/cli@latest, then run ng update @angular/cli inside existing projects to align workspace configurations.

The Angular CLI is maintained within the angular/angular monorepo under the packages/cli directory. When you update Angular CLI to the latest version, you are pulling the most recent stable release published to npm from the main branch, which includes the implementation logic found in packages/cli/src/commands/update and registry interaction code in packages/cli/src/commands/update/npm-registry.ts.

Understanding the Angular CLI Update Mechanism

Before executing commands, it helps to understand how the CLI manages its own versioning and upgrade process.

Where the CLI Version Is Defined

The CLI’s version is declared in packages/cli/package.json within the Angular source repository. This file specifies the current release number and dependencies. When the Angular team publishes a release, this version metadata is pushed to the npm registry, making it available for global installation.

How the Update Command Works Internally

The ng update command implementation resides in packages/cli/src/commands/update. This module checks your currently installed CLI version against the latest available version on npm by querying the registry via packages/cli/src/commands/update/npm-registry.ts, which utilizes the npm view endpoint to fetch version strings. If a newer version exists, the command orchestrates the download and replacement of the global binary.

Global Installation: Update Angular CLI to the Latest Version System-Wide

To update Angular CLI to the latest version across your entire system, you must first uninstall the existing global package to avoid version conflicts, then install the newest release.

Using npm:

npm uninstall -g @angular/cli
npm install -g @angular/cli@latest

Using Yarn:

yarn global remove @angular/cli
yarn global add @angular/cli@latest

Using pnpm:

pnpm remove -g @angular/cli
pnpm add -g @angular/cli@latest

After installation, verify the update by checking the version:

ng version

Local Workspace: Update Angular CLI to the Latest Version in Existing Projects

Updating the global CLI does not automatically modify your existing Angular workspaces. To update Angular CLI to the latest version within a specific project and align configuration files (angular.json, package.json, etc.) with new defaults, navigate to your project root and execute:

ng update @angular/cli

This command analyzes your workspace dependencies, updates the local @angular/cli package in node_modules, and applies schematic migrations to modify project configuration files if breaking changes exist between versions.

Summary

  • The Angular CLI version is defined in packages/cli/package.json and published to npm from the angular/angular repository.
  • Global updates require uninstalling the current CLI (npm uninstall -g @angular/cli) before installing the latest (npm install -g @angular/cli@latest).
  • Workspace updates use ng update @angular/cli to align local project configurations with the latest CLI defaults.
  • Internal logic for checking and fetching versions resides in packages/cli/src/commands/update and packages/cli/src/commands/update/npm-registry.ts.

Frequently Asked Questions

Do I need to update the Angular CLI globally for every project?

No. You only need to update the global CLI installation once per machine. However, you should run ng update @angular/cli inside each existing project directory to ensure local workspace configurations and dependencies match the global CLI version.

What is the difference between npm install -g @angular/cli@latest and ng update?

npm install -g @angular/cli@latest updates the global CLI binary on your system, affecting all new projects you create. ng update @angular/cli updates the local CLI dependency within a specific project and runs migration schematics to modify configuration files like angular.json.

Where does the Angular CLI check for the latest available version?

According to the Angular source code in packages/cli/src/commands/update/npm-registry.ts, the CLI queries the npm registry using the npm view endpoint to fetch the latest version string and compare it against your currently installed version.

Should I uninstall the old Angular CLI before installing the new version?

Yes. The recommended practice is to first run npm uninstall -g @angular/cli (or the equivalent for yarn/pnpm) to remove the old version and clear any cached binaries, then install the latest version cleanly with npm install -g @angular/cli@latest.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →