Angular CLI in 2026: How It Works, Key Commands & Best Practices

Gourav Soni
Gourav Soni
Managing Director
Share:

Introduction

Angular projects can quickly become difficult to manage when developers manually create files, configure builds, and repeat the same boilerplate setup on every new feature. Manual scaffolding introduces inconsistency, wastes development time, and makes it harder for teams to maintain a shared project structure. 

Angular CLI solves this by giving developers a standardized command line workflow for creating, developing, testing, and building Angular applications. Instead of hand writing configuration files or guessing at folder structure, developers run a single command and get a working, production ready setup. This article explains what Angular CLI is, how it works, how to install it, how to check your version, which commands matter most in 2026, and the best practices that keep Angular projects consistent and maintainable as they scale.

 

What Is Angular CLI?

Angular CLI is the official command line tool for creating, developing, testing, and building Angular applications. It is published on npm as the @angular/cli package and runs through a binary called ng. 

Every command that starts with ng, such as ng new or ng serve, is powered by Angular CLI. Rather than manually wiring together TypeScript compilation, bundling, a development server, and testing frameworks, Angular CLI ships preconfigured tooling that follows Angular’s own architectural conventions. This covers: 

  • Creating new Angular projects with a working folder structure 
  • Generating components, services, directives, pipes, guards, and interfaces 
  • Running a local development server with live reload 
  • Running unit tests and linting 
  • Building optimized production bundles 
  • Preparing deployment ready output 
  • Managing project configuration through angular.json 

Because Angular CLI is maintained directly by the Angular team, its release cycle tracks the Angular framework itself, so CLI updates generally arrive alongside framework updates rather than as a separate tool to track on its own schedule.

 

How Does Angular CLI Work?

Angular CLI sits on top of Node.js and npm. Once installed, it becomes an executable that reads a project’s angular.json configuration file to understand how to build, serve, and test that specific application. 

The typical Angular CLI workflow looks like this: 

  • Install Angular CLI through npm. 
  • Create a new project with ng new, which scaffolds folders, TypeScript configuration, and a starter application. 
  • Generate components, services, and other building blocks with ng generate as features are added. 
  • Run ng serve during development, which compiles the application, watches files for changes, and reloads the browser automatically. 
  • Run ng test to execute unit tests through the configured test runner. 
  • Run ng build to compile a production ready bundle with optimizations such as tree shaking and minification. 
  • Optionally run ng deploy or hand the build output to a hosting pipeline. 

Underneath these commands, Angular CLI coordinates TypeScript compilation, Angular’s own compiler, and modern build tooling to produce output without requiring developers to configure each tool individually. Node.js provides the runtime, npm manages the packages, and Angular CLI orchestrates how they work together for an Angular specific workflow.

 

How to Install Angular CLI

Before installing Angular CLI, a working Node.js and npm installation is required, since Angular CLI is distributed as an npm package. 

Step 1: Confirm Node.js and npm are installed

node -v
npm -v

Step 2: Install Angular CLI globally

npm install -g @angular/cli

This makes the ng command available anywhere on the system. 

Step 3: Verify the installation

ng version

This prints the installed Angular CLI version along with related package versions. 

Teams that want project level control instead of a global installation can also install Angular CLI as a local dev dependency and invoke it through npx ng or npm scripts, which helps keep CLI versions consistent across a team. 

 

How to Check the Angular CLI Version

Run ng version in a terminal, inside or outside an Angular project directory, to see the installed Angular CLI version. 

ng version

It is worth understanding the difference between three related version numbers that often get confused: 

  • Angular CLI version: the version of the @angular/cli package itself, shown at the top of the ng version output. 
  • Angular framework version: the version of @angular/core, listed separately in the same output and also visible in a project’s package.json. 
  • Node.js version: the JavaScript runtime version, checked separately with node -v, which Angular CLI depends on to run. 

Since Angular version 7, Angular core and Angular CLI major versions are aligned, so a project running Angular 22 should generally use Angular CLI 22.x as well. As of mid 2026, Angular 22 is the current stable framework release, published June 3, 2026, with Angular CLI 22.1.x as the corresponding CLI release on npm. Mismatched major versions between CLI and core are a common source of build errors, which is why version compatibility deserves attention before starting new work or running an update. 

 

Most Useful Angular CLI Commands

The table below covers the Angular CLI commands developers use most often in day to day work. 

Command What It Does Common Use
ng new Creates a new Angular application with a working project structure Starting a new project
ng serve Starts a local development server with live reload Day to day development
ng generate (ng g) Generates components, services, directives, pipes, guards, and more Scaffolding new project pieces
ng build Compiles the application into a deployable build Producing dev or production builds
ng test Runs unit tests through the configured test runner Verifying code changes
ng lint Checks code against configured linting rules Enforcing code quality
ng version Displays Angular CLI and framework version information Checking compatibility
ng update Updates Angular CLI, Angular packages, and related dependencies Upgrading a project
ng add Adds and configures a new library or package into a project Integrating third party packages
ng deploy Builds and deploys the application to a supported hosting target Shipping to production

 

How to Create an Angular Application With Angular CLI

Creating a new Angular application starts with a single command: 

ng new project-name

Angular CLI then prompts for a small number of configuration choices, such as whether to include routing and which stylesheet format to use. Once these choices are made, Angular CLI scaffolds the full project folder structure, installs dependencies, and sets up a working starter application automatically. 

After the project is created, move into the project directory: 

cd project-name

Then start the local development server: 

ng serve

This compiles the application and makes it available at a local address, typically http://localhost:4200, with automatic reloading whenever source files change. This workflow removes the need to manually configure a build pipeline before writing the first line of application code.

 

Angular CLI Code Generation

Angular CLI’s code generation commands create new project pieces that already follow Angular’s file naming and structural conventions. Common examples include: 

ng generate component feature-name
ng generate service feature-name
ng generate directive feature-name
ng generate pipe feature-name
ng generate guard feature-name
ng generate interface feature-name

The shorter alias ng g works identically, so ng g c feature-name generates a component just as ng generate component feature-name does. Many developers default to the alias during daily work because it reduces typing without changing the output. 

Generated code matters beyond convenience. When every developer on a team generates files the same way, project structure stays consistent regardless of who wrote a given feature. This reduces boilerplate, cuts down on setup mistakes, and makes it easier for new team members to find their way around a codebase, since every component, service, or pipe follows the same predictable pattern.

 

Angular CLI Build and Development Workflow

Angular CLI supports the full development lifecycle from a single tool. During active development, ng serve provides a fast feedback loop with live reload. When code needs to be verified, ng test runs the project’s unit tests, and ng lint checks the codebase against configured style and quality rules. 

When it is time to ship, ng build compiles a production ready bundle with optimizations such as minification, tree shaking, and ahead of time compilation applied automatically, rather than requiring a hand built build tool configuration. Because these steps run through the same CLI across every environment, from a developer’s laptop to a continuous integration pipeline, teams get repeatable results. The same ng build command produces the same kind of output whether it runs locally or on a build server, which removes a common source of environment specific issues. 

Version updates follow the same pattern. Running ng update checks for available updates to Angular packages and applies supported migrations automatically, which keeps projects aligned with current best practices without requiring a manual rewrite of configuration files. 

 

Angular CLI Best Practices for 2026

Keep Angular CLI and Angular versions aligned

Mismatched major versions between @angular/cli and @angular/core are one of the most common causes of build failures, since CLI schematics and build tooling are written against a specific framework version. 

Use the official Angular CLI

Community scaffolding tools can fall out of sync with Angular’s own conventions, while the official CLI is maintained directly by the Angular team and updated alongside the framework.

Avoid unnecessary manual configuration

Angular CLI already handles TypeScript compilation, bundling, and optimization. Overriding these settings without a clear reason increases maintenance burden and makes future upgrades harder.

Use CLI generators consistently

When every developer generates components, services, and modules the same way, the codebase stays predictable, which matters more as a team or codebase grows.

Keep project dependencies updated

Running ng update regularly, rather than letting a project drift several major versions behind, keeps upgrades small and manageable instead of turning into a large migration project later.

Use production builds appropriately

ng build with a production configuration applies optimizations that are not needed during local development, so reserving them for deployment builds keeps local development fast.

Standardize CLI workflows across teams

Documenting which commands a team uses for common tasks, such as generating a new feature module, reduces onboarding time and prevents inconsistent project structure.

Verify compatibility before major updates

Reviewing the official Angular update guide before running ng update across a major version boundary helps catch breaking changes before they reach production.

Use version control alongside CLI changes

Running ng generate or ng update against a clean git state makes it easy to review exactly what the CLI changed and to revert if something goes wrong.

Keep generated code consistent with project conventions

Angular CLI’s defaults are a strong starting point, but teams should document any deviations, such as custom folder structures, so generated code does not drift from the rest of the codebase. 

 

Common Angular CLI Mistakes to Avoid

  • Installing a Node.js version that is incompatible with the current Angular CLI release, which can cause installation or build failures 
  • Confusing the Angular CLI version with the Angular framework version when troubleshooting errors 
  • Ignoring dependency compatibility warnings during ng update instead of reviewing them 
  • Running CLI commands from the wrong directory, outside the actual project root 
  • Manually restructuring generated project folders without a clear reason, which complicates future CLI operations 
  • Jumping across multiple major versions during an update instead of updating one major version at a time 
  • Ignoring build warnings that later surface as production issues 
  • Following outdated Angular CLI tutorials that reference commands or flags from older major versions 
  • Installing unnecessary global packages that create version conflicts with project level tooling 
  • Not committing configuration changes after running generators or updates, which makes changes hard to track or revert 

 

When Should You Use an Angular Development Team?

Angular CLI is built for individual productivity, but its real value shows up when multiple developers work on the same Angular application. Consistent scaffolding, standardized workflows, and predictable project structure matter far more once a codebase is shared across a team, maintained over multiple releases, or expanded across several related applications. 

For organizations reaching this stage, bringing in experienced Angular developers can help maintain these standards as a project grows. Businesses scaling an Angular application, or maintaining more than one, sometimes choose to hire Angular developers or work with a dedicated Angular development team so that CLI workflows, code generation conventions, and update practices stay consistent across the entire codebase rather than depending on a single developer’s habits. 

 

Conclusion

Angular CLI is the command line tool that makes Angular application development consistent, from the first ng new command through generating components, running tests, and producing production builds. Understanding how it works, keeping it installed correctly, checking versions before troubleshooting, and following a handful of best practices around updates and code generation prevents most of the friction that shows up in Angular projects as they grow. 

The commands covered here, ng new, ng serve, ng generate, ng build, ng test, and ng update, cover the majority of what a developer needs day to day. Teams that standardize how they use Angular CLI, and stay current with Angular CLI updates, tend to spend far less time on configuration drift and far more time shipping features. 

Businesses building or scaling Angular applications who want that consistency across a larger team can explore dedicated Angular development support through HireDeveloper.dev.

 

References and Sources

Angular CLI Overview, official documentation: https://angular.dev/tools/cli 

Angular Versioning and Releases, official documentation: https://angular.dev/reference/releases 

Angular CLI ng update reference, official documentation: https://angular.dev/cli/update 

@angular/cli package registry listing, npm: https://www.npmjs.com/package/@angular/cli 

What Is Angular CLI, Mindmajix: https://mindmajix.com/what-is-angular-cli 

Getting Started with the Angular CLI, BrieBug: https://briebug.com/articles/getting-started-with-the-angular-cli/ 

Guide to Using Angular CLI, Angular Minds: https://www.angularminds.com/blog/guide-to-using-angular-cli 

Angular CLI: A Comprehensive Guide, ToTheNew: https://www.tothenew.com/blog/angular-cli-a-comprehensive-guide/

Frequently Asked Questions About Angular CLI in 2026

Find answers to common questions about Angular CLI, including how it works, essential commands, project setup, development workflows, testing, builds, optimization, and best practices for building modern Angular applications in 2026.

What is Angular CLI used for?

Angular CLI is used to create, develop, test, and build Angular applications from the command line. It scaffolds new projects, generates components and services, runs a development server, executes tests, and compiles production ready builds through a consistent set of ng commands. 

How do I install Angular CLI?

Install Node.js and npm first, then run npm install -g @angular/cli in a terminal. This installs Angular CLI globally and makes the ng command available for creating and managing Angular projects. 

How do I check my Angular CLI version?

Run ng version in a terminal. This displays the installed Angular CLI version along with the Angular framework version and related package versions used in the current project. 

What is the difference between Angular and Angular CLI?

Angular is the web application framework used to build the application itself, while Angular CLI is the command line tool used to create, generate, test, and build Angular projects. Angular CLI is a companion tool, not the framework. 

What is the latest Angular CLI version?

As of mid 2026, Angular CLI 22.1.x is the current release, aligned with Angular framework version 22. Since CLI and framework major versions are aligned, checking the official Angular CLI documentation or running ng version confirms the exact current release. 

Is Angular CLI necessary for Angular development?

Angular CLI is not strictly required, but it is the standard, officially supported way to build Angular applications. Skipping it means manually configuring TypeScript, bundling, testing, and build tooling, which most teams avoid. 

What command creates a new Angular application?

ng new project-name creates a new Angular application, scaffolding the folder structure, configuration files, and a starter app after prompting for a few setup choices. 

How do I update Angular CLI?

Run ng update @angular/cli @angular/core to update Angular CLI and the framework together. Reviewing the official Angular update guide before running this across a major version boundary helps avoid unexpected breaking changes.