3

A month ago I started a Angular 7 project. Now I need to include Angular Material into the project and npm i it. It recently came out in a version 8 which seems incompatible with Angular 7.

So I started updating Angular 7 → Angular 8: ng update @angular/cli @angular/core. This gives me an error:

$ng update @angular/cli @angular/core

Package "@ngrx/core" has an incompatible peer dependency to "rxjs" (requires "^5.0.0-beta.12", would install "6.5.2").

Incompatible peer dependencies found. See above.

In this guide https://update.angular.io/#7.0:8.0 I found:

"Once you and all of your dependencies have updated to RxJS 6, remove rxjs-compat."

I should be on rxjs^6. I need rxjs-compat to be able to use my swagger client generated with https://github.com/swagger-api/swagger-codegen. I tried to remove "rxjs-compat": "^6.5.2" from package.json, but no luck.

package.json:

{
  "name": "fem",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "$(npm bin)/cypress open",
    "e2e-protractor": "ng e2e",
    "swagger-generate": "swagger-codegen generate -i ./swagger.json -l typescript-angular -o ./src/swagger-client"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.15",
    "@angular/cdk": "^8.0.1",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/material": "^8.0.1",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^7.4.0",
    "@ngrx/entity": "^7.4.0",
    "@ngrx/router-store": "^7.4.0",
    "@ngrx/schematics": "^7.4.0",
    "@ngrx/store": "^7.4.0",
    "@ngrx/store-devtools": "^7.4.0",
    "angular-in-memory-web-api": "^0.8.0",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.6.9",
    "date-fns": "^1.30.1",
    "formdata-polyfill": "^3.0.18",
    "hammerjs": "^2.0.8",
    "rxjs": "~6.3.3",
    "rxjs-compat": "^6.5.2",
    "tslib": "^1.9.0",
    "uuid": "^3.3.2",
    "web-animations-js": "^2.3.1",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.9",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/date-fns": "^2.6.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "@types/uuid": "^3.4.4",
    "codelyzer": "~4.5.0",
    "cypress": "^3.3.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

So my goals are:

  1. be able to use Angular Material v8 in the project
  2. update to Angular v8
  3. keep using the generated Swagger client
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
olefrank
  • 6,452
  • 14
  • 65
  • 90

2 Answers2

1

steps upgrade angular with ngrx

Uninstall ngrx packages

run command ng update @angular/cli @angular/core

errors will be triggered while migrating angular core packages due to unavailability of ngrx packages

to resolve issues reinstall ngrx packages

run command ng update @angular/core --from 7 --to 8 --migrate-only

Done angular upgrade

Hemadri
  • 11
  • 1
0

You need to abandon the npm direct manipulation to upgrade Angular and embrace the new Angular Schematics that does all the required stuff automagically.

Use ng update instead and update each package from there, you can update the other libraries with npm, but the new paradigm for Angular and it's Libraries is via Schematics .

Embrace their power and develop your own code generators ;)

Mateo Tibaquira
  • 2,059
  • 22
  • 23