Wain2021
Wain2021

Reputation: 349

Cannot update a project from Angular 13 to 14

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?

Upvotes: 19

Views: 23562

Answers (6)

Meagan Ritchie
Meagan Ritchie

Reputation: 1

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.

Upvotes: 0

PaulF
PaulF

Reputation: 1

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.

Upvotes: 0

Leandro Ariel
Leandro Ariel

Reputation: 1381

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

Upvotes: 0

NeNaD
NeNaD

Reputation: 20304

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

Upvotes: 25

Marek
Marek

Reputation: 4081

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

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

Upvotes: 3

Krrsantan
Krrsantan

Reputation: 31

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

Upvotes: 3

Related Questions