Global Angular CLI version greater than local version

Typically this is a Warning, it doesn't stop execution of the command, you can ignore and carry on with your work. The intention of the warning is to keep you appraised of the version mismatch.

An example of such an error/warning is

  • Your global Angular CLI version (13.2.2) is greater than your local version (13.1.2). The local Angular CLI version is used.
  • Your global Angular CLI version (11.1.4) is greater than your local version (10.1.7). The local Angular CLI version is used.

However, there are compatibility issues between certain Angular versions, where this becomes an error and need to be resolved.

Preface

An Angular workstation consists of two angular packages

Global CLI
  • Installed in the system
  • System level
  • Global install is used to create new projects.
  • Some commands are dependent on global install irrespective of local install viz new, generate...
Local CLI
  • Installed in node_modules
  • Project specific
  • Application version is maintained by local install promoting stability from migration issues
  • Some commands only make sense with local install viz, build, serve...

Causes of this Warning

This warning is caused by a version mismatch between global and local angular CLI versions. Version mismatch can arise in either of the two conditions(duh!)

  • You updated the global version and now it's asking you to update your local (application) version
  • Working on an application that you just cloned, download etc., which is outdated

Troubleshoot 1

Before we deal with versioning, lets find out what are the local and global versions of Angular CLI by using the following command

  • Execute the command in a terminal outside an angular application, to find the version of Global Angular CLI
  • Execute the command in a terminal inside an angular application, to find the version of Local Angular CLI
ng version



Higher global CLI versions doesn't always support lower versions of local CLI. If you intend to keep using your local angular CLI version, update the global version to your local version as shown below.

Update Local CLI to match Global CLI

ng update
ng update @angular/cdk @angular/cli @angular/core @angular/material etc...



On the contrary if you want to keep using the local Angular CLI version and don't want to the bothered, you can update Global CLI to match the Local Angular CLI version as shown below.

Update Global CLI to match Local CLI

npm install --save @angular/cli@localVersion

Troubleshoot 2

In case you have multiple applications with varied versions and you want to keep them that way

Warning Case: Conveniently ignore the warning, "Global Angular CLI version greater than local version". Update your global CLI to the latest version while ensuring that all your projects are supported by their local versions. Tutorial to Install/Update Angular CLI.


Error Case: If there are compatibility issues between the varied versions you are using with the global CLI version

  • Best policy is to migrate the versions with compatibility issues to compatible versions.
  • If migration is not a choice, try installing multiple global angular CLI with their separate paths and have the corresponding compatible projects under their wing. Caution be advised, as this can be unreliable with stability issues waiting to happen.
navigation