Home > Software engineering >  This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular ve
This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular ve

Time:12-16

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!

CodePudding user response:

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

CodePudding user response:

npm i @angular-devkit/[email protected] --force
npm i @angular/cli@12
  • Related