17

I have a project which uses Angular 13 and I want to update it to Angular 14.

When I try to update with:

ng update @angular/core@14 @angular/cli@14

I get:

Package "@angular-eslint/schematics" has an incompatible peer dependency to "@angular/cli" (requires ">= 13.0.0 < 14.0.0", would install "14.0.1").

Any ideas on how to avoid this error?

NeNaD
  • 18,172
  • 8
  • 47
  • 89
Wain2021
  • 299
  • 1
  • 4
  • 12
  • 1
    1. Remove "@angular-eslint/schematics" package from your package.json, 2. Sometimes you need to execute `ng update @angular/core@14 @angular/cli@14 --force` – Murhaf Sousli Jun 10 '22 at 10:04
  • I tried that and it installed but now when I try to do an ng serve I get this error: This version of CLI is only compatible with Angular versions ^13.0.0 || ^13.3.0-rc.0, but Angular version 14.0.1 was found instead. ???? – Wain2021 Jun 10 '22 at 10:18
  • I have the same issue after updating the application to angular 14, cannot build although I have another application updated and built successfully and compared the versions in both and both are the same – Abd-elhameed Quraim Jun 10 '22 at 18:46
  • I am able to run ng serve after updating to Angular 14, but ng build doesn't work. – Arjav Dave Jun 10 '22 at 21:22
  • I am dealing with the same problem with `@angular-flex-layout`. The only way at the moment to get it working in angular 14 is by `npm i --force`, because flex-layout is not marked as supported yet. – rick Jun 15 '22 at 19:18

6 Answers6

19

I have two suggestions:


Suggestion 1:

  1. First upgrade the @angular-eslint/schematics package
ng update @angular-eslint/schematics@14
  1. Upgrade Angular
ng update @angular/core@14 @angular/cli@14

Suggestion 2:

  1. Remove all @angular-eslint packages from package.json file and run npm install so the packages would be deleted
npm install
  1. Upgrade Angular
ng update @angular/core@14 @angular/cli@14
  1. Add all @angular-eslint packages with ng add @angular-eslint/schematics command:
ng add @angular-eslint/schematics
NeNaD
  • 18,172
  • 8
  • 47
  • 89
  • 2
    Suggestion 1.1 returns `Package specified by '@angular-eslint/schematics@14' does not exist within the registry.` until [this PR](https://github.com/angular-eslint/angular-eslint/pull/1004) gets merged to release v14 of @angular-eslint – JWess Jun 13 '22 at 20:17
3

Take a look at this draft PR's description instructions which will allow you to use an alpha version of the @angular-eslint/schematics package which will therefore allow you to upgrade but personally i would wait until this is merged and stabled before upgrading.

https://github.com/angular-eslint/angular-eslint/pull/1004

Krrsantan
  • 31
  • 1
3

Use ng update @angular/core@14 @angular/cli@14 --force

After the update, remove node_modules and package.lock. Run npm install

Marek
  • 3,935
  • 10
  • 46
  • 70
0

For Ionic V6 with Cordova(not Capacitor). If you want to migrate to angular 13 to 14 first run:

ng update @angular/core@14 @angular/cli@14

Then remove you package-lock.json and node_modules. Modify you package.json like this:

In dependencies:

"dependencies": {
    "@angular/common": "^14.1.3",
    "@angular/core": "^14.1.3",
    "@angular/fire": "^7.4.1",
    "@angular/forms": "^14.1.3",
    "@angular/platform-browser": "^14.1.3",
    "@angular/platform-browser-dynamic": "^14.1.3",
    "@angular/router": "^14.1.3",
    "@awesome-cordova-plugins/admob-pro": "^5.44.0",
    "@awesome-cordova-plugins/fcm": "^5.44.0",
    "@ionic-native/camera": "^5.36.0",
    "@ionic-native/device": "^5.36.0",
    "@ionic/angular": "^6.2.3",
    "@ionic/cordova-builders": "^7.0.0",
    "date-fns": "^2.29.2",
    "firebase": "^9.9.3",
    "rxjs": "~6.6.0",
    "ts-md5": "^1.3.1",
    "tslib": "^2.4.0",
    "zone.js": "~0.11.8"
  },

In devDependencies

  "devDependencies": {
    "@angular-devkit/build-angular": "^14.1.3",
    "@angular-eslint/builder": "~13.5.0",
    "@angular-eslint/eslint-plugin": "~13.5.0",
    "@angular-eslint/eslint-plugin-template": "~13.5.0",
    "@angular-eslint/template-parser": "~13.5.0",
    "@angular/cli": "^14.1.3",
    "@angular/compiler": "^14.1.3",
    "@angular/compiler-cli": "^14.1.3",
    "@angular/language-service": "^14.1.3",
    "@ionic/angular-toolkit": "^7.0.0",
    "@types/jasmine": "^4.3.0",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "^18.7.13",
    "@typescript-eslint/eslint-plugin": "5.34.0",
    "@typescript-eslint/parser": "5.34.0",
    "cordova-android": "^10.1.2",
    "cordova-plugin-admobpro": "^8.13.1",
    "cordova-plugin-camera": "^6.0.0",
    "es6-promise-plugin": "^4.2.2",
    "eslint": "^8.22.0",
    "eslint-plugin-import": "2.26.0",
    "eslint-plugin-jsdoc": "39.3.6",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "jasmine-core": "~4.3.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~10.9.1",
    "typescript": "~4.7.3"
  },

Finally you need to run npm install to update the folder node_modules

Leandro Ariel
  • 727
  • 8
  • 5
0

In my case, I had to follow the instructions from https://angular.io/guide/schematics-for-libraries#configure-the-new-schematic

Needed to add schema.json and reference that from the collections.js file. I could not find any documentation about this in the change logs.

PaulF
  • 1
  • 1
0

I was updating a new-to-me portal and had ngx-build-plus installed. This was overriding and causing the issue. Just had to update ngx-build-plus.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 26 '23 at 11:55