Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular CLI version is not compatible with Angular version

My angular project was running fine but when I updated Angular to version 9 it started giving me this error:

This version of CLI is only compatible with Angular versions 0.0.0 || ^10.0.0-beta || >=10.0.0 <11.0.0,
but Angular version 9.1.1 was found instead.

I updated the CLI but it is still giving me the same error.

My CLI version is:

Angular CLI: 10.0.0-next.0
Node: 12.13.0
OS: win32 x64

Angular: 9.1.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
like image 224
Shivank Avatar asked Dec 05 '22 08:12

Shivank


1 Answers

The Problem

The CLI version you have installed doesn't meet the requirements for your Angular version as the error says:

This version of CLI is only compatible with Angular versions 0.0.0 || ^10.0.0-beta || >=10.0.0 <11.0.0

The Fix

Uninstall @angular/cli and be sure to install @angular/cli that is in the 9.1.x version range so that it matches the requirements for the Angular 9.1 version.

Angular: 9.1.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Update Angular Project

To uninstall and reinstall the @angular/cli package in your application, navigate to the root folder of the project and run the following:

# uninstall previous version
npm uninstall @angular/cli --save-dev

# install 9.1.x specific version
npm install @angular/cli@~9.1.0 --save-dev

💡 The --save-dev parameter will update your package.json devDependencies

Update Global Dependency

If you have installed angular/cli globally, you need to add -g at the end of the commands and omit the --save-dev parameter:

# uninstall previous globally installed version
npm uninstall @angular/cli -g

# install 9.1.x specific version globally
npm install @angular/cli@~9.1.0 -g

💡 If you are not sure what global version is installed (or if you have installed @angular/cli globally) you can run the following command to list your globally installed NPM packages:

npm ls -g --depth=0
like image 140
j3ff Avatar answered Mar 04 '23 06:03

j3ff