This version of CLI is only compatible with Angular versions ^13.0.0, but Angular version 12.2.13 was found instead

35,545

Solution 1

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

Solution 2

I had the same error, but I was using V 11.2.14.

The simple solution is to go to the package.json file and change

"@angular-devkit/build-angular": "^13.0.2"

(it is inside dependencies)

to your compatible version.

So when I changed it to

"@angular-devkit/build-angular": "~0.1102.3",

it worked.

Share:
35,545
Morgs
Author by

Morgs

Updated on July 05, 2022

Comments

  • Morgs
    Morgs almost 2 years

    My Ionic project was running fine a month ago. Today when I tried ionic serve or ionic build, I get the below error:

    Enter image description here

    What CLI version is compatible with Angular version 12.2.13? If you really want to know why I am asking this question you can ready further.

    So I followed the advice to upgrade to Angular 13 on the official Angular website, I used the following command: npm @angular/cli@13 update @angular/core@13 @angular/cli@13.

    This route asked me to upgrade my Node.js to version 16 (latest, current). After upgrading Node.js to v16 I retried to upgrade to Angular 13 and during this process the installation failed/stopped due to unsupported dependencies and so on.

    I googled most solutions, tried, and wound up with a project where all my plugins can't be found and so on. So I reversed the above process by uninstalling Node.js v16 to v12, removed npm, the node_modules folder and now I am back at the point where I am getting the below error in the picture.

    Here's my developer environment from ionic info:

    Enter image description here

    Here's a copy of my package.json file:

        "dependencies": {
        "@angular/common": "~12.2.8",
        "@angular/core": "~12.2.8",
        "@angular/forms": "~12.2.8",
        "@angular/platform-browser": "~12.2.8",
        "@angular/platform-browser-dynamic": "~12.2.8",
        "@angular/router": "~12.2.8",
        "@babel/compat-data": "^7.8.0",
        "@ionic-native/app-version": "^5.36.0",
        "@ionic-native/call-number": "^5.36.0",
        "@ionic-native/camera": "^5.23.0",
        "@ionic-native/core": "^5.0.0",
        "@ionic-native/device": "^5.36.0",
        "@ionic-native/file": "^5.36.0",
        "@ionic-native/file-transfer": "^5.23.0",
        "@ionic-native/full-screen-image": "^5.23.0",
        "@ionic-native/in-app-browser": "^5.36.0",
        "@ionic-native/ionic-webview": "^5.36.0",
        "@ionic-native/keyboard": "^5.36.0",
        "@ionic-native/onesignal": "^5.36.0",
        "@ionic-native/photo-viewer": "^5.23.0",
        "@ionic-native/splash-screen": "^5.36.0",
        "@ionic-native/status-bar": "^5.36.0",
        "@ionic/angular": "^5.0.0",
        "@ionic/storage-angular": "^3.0.6",
        "bufferutil": "^4.0.1",
        "call-number": "^1.0.1",
        "cordova-plugin-actionsheet": "^2.3.3",
        "cordova-plugin-dialogs": "^2.0.2",
        "core-js": "^2.5.4",
        "rxjs": "~6.5.1",
        "tslib": "^1.9.0",
        "utf-8-validate": "^5.0.2",
        "zone.js": "~0.11.4"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "^13.0.2",
        "@angular/cli": "^12.2.8",
        "@angular/compiler": "^12.2.8",
        "@angular/compiler-cli": "^12.2.8",
        "@angular/language-service": "~12.2.8",
        "@ionic/angular-toolkit": "^5.0.3",
        "@types/jasmine": "~3.3.8",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
        "codelyzer": "^5.0.0",
        "cordova-android": "^9.1.0",
        "cordova-plugin-app-version": "^0.1.12",
        "cordova-plugin-camera": "^6.0.0",
        "cordova-plugin-device": "^2.0.3",
        "cordova-plugin-file": "^6.0.2",
        "cordova-plugin-file-transfer": "git+https://github.com/apache/cordova-plugin-file-transfer.git",
        "cordova-plugin-inappbrowser": "^4.1.0",
        "cordova-plugin-ionic-keyboard": "^2.2.0",
        "cordova-plugin-ionic-webview": "^5.0.0",
        "cordova-plugin-splashscreen": "^6.0.0",
        "cordova-plugin-statusbar": "^2.4.3",
        "cordova-sqlite-storage": "^6.0.0",
        "jasmine-core": "^3.4.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "^6.3.4",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.1",
        "karma-jasmine": "~2.0.1",
        "karma-jasmine-html-reporter": "^1.4.0",
        "onesignal-cordova-plugin": "^3.0.0",
        "protractor": "^7.0.0",
        "ts-node": "~7.0.0",
        "tslint": "~5.15.0",
        "typescript": "~4.3.5"
      },
      "description": "Vuyou's Funerals",
      "cordova": {
        "plugins": {
          "cordova-plugin-inappbrowser": {},
          "mx.ferreyra.callnumber": {},
          "cordova-plugin-file-transfer": {},
          "onesignal-cordova-plugin": {},
          "cordova-plugin-camera": {
            "ANDROIDX_CORE_VERSION": "1.6.+"
          },
          "cordova-plugin-ionic-webview": {},
          "cordova-plugin-ionic-keyboard": {},
          "cordova-plugin-splashscreen": {},
          "cordova-plugin-device": {},
          "cordova-plugin-statusbar": {},
          "cordova-sqlite-storage": {},
          "cordova-plugin-app-version": {}
        },
        "platforms": []
      }
    
    • GaurangDhorda
      GaurangDhorda over 2 years
      Updated angular locally, using ngUpdate
    • Morgs
      Morgs over 2 years
      @GaurangDhorda I don't think I understand what you mean? What I am asking is, what is the correct CLI version for Angular v12.2.13 ?
    • AlexElin
      AlexElin over 2 years
      try changing angular-devkit/build-angular version from ^13.0.2 to ^12.2.8
    • Morgs
      Morgs over 2 years
      @AlexElin you saved my entire world! Thank you very much now my app is running again. I wonder how on earth the CLI version changed
    • Ian Campbell
      Ian Campbell over 2 years
      This question is being discussed on Meta, which explains its sudden scrutiny.
    • Donald Duck
      Donald Duck over 2 years