Reputation: 105
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
Upvotes: 8
Views: 61136
Reputation: 11
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.
Upvotes: 0
Reputation: 179
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.
Upvotes: 8
Reputation: 6089
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
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 yourpackage.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
Upvotes: 15