Avinash Gayam
Avinash Gayam

Reputation: 23

This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular version 14.2.12 was found instead

My global CLI version: ng version

My project CLI version: ng version

My Package.json:

"dependencies": {
  "@angular/animations": "^14.2.12",
  "@angular/common": "^14.2.12",
  "@angular/compiler": "^14.2.12",
  "@angular/core": "^14.2.12",
  "@angular/forms": "^14.2.12",
  "@angular/platform-browser": "^14.2.12",
  "@angular/platform-browser-dynamic": "^14.2.12",
  "@angular/router": "^14.2.12",
  "angular-component-library": "16.0.0-beta.1",
  "rxjs": "^7.4.0",
  "tslib": "^2.3.0",
  "zone.js": "~0.11.4"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~13.3.2",
  "@angular/cli": "~15.0.4",
  "@angular/compiler-cli": "~15.0.4",
  "@types/jasmine": "~3.10.0",
  "@types/node": "^12.11.1",
  "jasmine-core": "~4.0.0",
  "karma": "~6.3.0",
  "karma-chrome-launcher": "~3.1.0",
  "karma-coverage": "~2.1.0",
  "karma-jasmine": "~4.0.0",
  "karma-jasmine-html-reporter": "~1.7.0",
  "ts-node": "~7.0.0",
  "tslint": "~5.15.0",
  "typescript": "~4.6.2"
}

on ng serve, I see the following error

This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular version 14.2.12 was found instead.

Tried playing around by installing and uninstalling multiple CLI versions but nothing helped resolve this. Looking for some help/insights on this. Thanks!

Upvotes: 1

Views: 6497

Answers (2)

Sanket Pathre
Sanket Pathre

Reputation: 1

I also face same issue. But in my case package's for Angular 14 was upto date. Issue was with "ngx-build-plus" package use for building Angular app in angular.json Angular.json

When I check package.json, it was not update as per Angular version and still pointing to old version(13.x) of Angular. I updated ngx-build-plus package to 14.x.x and did "npm install" again and then "npm start" and it work as expected.

So far above issue when you check which package is use to build you angular project in "Angular.json" file and set its proper version in pacakge.json resolve my issue.

Upvotes: 0

You global can be higner than whats in your dev dependacies. Just keep the versions the same. these 3 seems off compared to the rest.

  "@angular-devkit/build-angular": "~13.3.2",
  "@angular/cli": "~15.0.4",
  "@angular/compiler-cli": "~15.0.4",

the reest is version 14.2.12

a simple fix would be change these to

  "@angular-devkit/build-angular": "~14.2.12",
  "@angular/cli": "~14.2.12",
  "@angular/compiler-cli": "~14.2.12",

and just run npm install

Upvotes: 0

Related Questions