8

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
1
  • try to install nvm github.com/nvm-sh/nvm. it helps to manage multiple npm versions Commented Apr 15, 2020 at 9:40

3 Answers 3

15

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
Sign up to request clarification or add additional context in comments.

2 Comments

Uninstalling and installing globally a specific verion (in my case 11.2.18) works !
Unfortunately , this solution won't works for me , I'm getting this error : npm ERR! While resolving: @angular/[email protected] npm ERR! Found: @angular/[email protected]
8

You can update the project if you want it.

In the root project folder write:

ng update @angular/core @angular/cli

This will upgrade the package.json file with the module versions installed in "node_modules" folder.

There are specific updating instructions depending from/to wich version do you want to update. Visit Angular update guide for that.

Comments

0

Visit https://update.angular.io/ enter the details of your angular version to your targeted angular version, this would update the cli as well as the project files. Just copy-paste the cmd then into the terminal and you're good to go.

Still, if you see some weird errors, check if the node_modules folder is present or not, if present then delete it and run - npm install This might only work if you have the package.json file. If you still get some error then see what the error says, delete the error line from package.json, and try once if working.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.