Rolling back an angular 13 to 14 upgrade and now npm update fails - peer dependencies

Discussão em 'Angular' iniciado por Werner Reiche, Dezembro 11, 2024.

  1. I was performing an upgrade from Angular 13 to Angular 14 and ran into problems. I've reverted back to Angular 13, but now "npm update" reports peer dependency problems within the angular components.

    My angular versions are:

    Angular CLI: 13.3.11
    Node: 20.12.2 (Unsupported)
    Package Manager: npm 10.8.2
    OS: win32 x64

    Angular: 13.4.0
    ... animations, compiler, compiler-cli, core, forms
    ... language-service, platform-browser, platform-browser-dynamic
    ... router, service-worker

    Package Version
    ------------------------------------------------------------
    @angular-devkit/architect 0.1303.11
    @angular-devkit/build-angular 13.3.11
    @angular-devkit/core 13.3.11
    @angular-devkit/schematics 13.3.11
    @angular/cdk 13.3.9
    @angular/cli 13.3.11
    @angular/material 13.3.9
    @angular/material-moment-adapter 13.3.9
    @schematics/angular 13.3.11
    rxjs 7.8.1
    typescript 4.6.4

    Warning: The current version of Node (20.12.2) is not supported by Angular.


    My package.json looks like:

    {
    "name": "app",
    "title": "ABX",
    "company": "SkyWare Labs Inc.",
    "version": "2.3.1",
    "scripts": {
    "ng": "ng",
    "clean": "rimraf ./dist",
    "start": "ng serve --port 4200",
    "build": "ng build",
    "build:prod": "ng build --configuration production",
    "test": "ng test --watch=false --browsers=ChromeHeadlessCustom",
    "test:watch": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ngcc"
    },
    "private": true,
    "dependencies": {
    "@angular/animations": "~13.4.0",
    "@angular/cdk": "^13.3.9",
    "@angular/compiler": "~13.4.0",
    "@angular/core": "^13.4.0",
    "@angular/forms": "~13.4.0",
    "@angular/material": "^13.3.9",
    "@angular/material-moment-adapter": "~13.3.9",
    "@angular/platform-browser": "~13.4.0",
    "@angular/platform-browser-dynamic": "~13.4.0",
    "@angular/router": "~13.4.0",
    "@angular/service-worker": "~13.4.0",
    "@ant-design/colors": "^7.0.2",
    "@sentry/angular": "^6.19.7",
    "@sentry/tracing": "^6.19.7",
    "@types/leaflet": "^1.9.8",
    "@types/mixpanel-browser": "^2.35.6",
    "angulartics2": "^12.1.0",
    "chart.js": "^2.9.4",
    "cors": "^2.8.5",
    "jspdf": "^2.5.1",
    "jspdf-autotable": "^3.5.25",
    "leaflet": "^1.7.1",
    "leaflet-easybutton": "^2.4.0",
    "mixpanel-browser": "^2.41.0",
    "moment": "^2.29.1",
    "ng2-charts": "^2.4.2",
    "ngx-mat-select-search": "^4.1.1",
    "ngx-material-file-input": "^3.0.0",
    "ngx-webstorage-service": "^5.0.0",
    "nvm": "^0.0.4",
    "rxjs": "^7.4.0",
    "tslib": "^2.2.0",
    "uuid": "^8.3.2",
    "xlsx": "^0.17.0",
    "zone.js": "~0.11.4"
    },
    "devDependencies": {
    "@angular-devkit/build-angular": "^13.3.11",
    "@angular/cli": "^13.3.11",
    "@angular/compiler-cli": "~13.4.0",
    "@angular/language-service": "~13.4.0",
    "@types/jasmine": "^4.0.3",
    "@types/jasminewd2": "^2.0.9",
    "@types/node": "^12.20.15",
    "codelyzer": "^6.0.2",
    "jasmine-core": "~4.1.1",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.3.20",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.0.1",
    "karma-jasmine-html-reporter": "^1.7.0",
    "protractor": "~7.0.0",
    "puppeteer": "^2.1.1",
    "ts-node": "10.7.0",
    "tslint": "~6.1.0",
    "typescript": "^4.6.3"
    },
    "overrides": {
    "ng2-charts": {
    "rxjs": "^7.4.0"
    }
    }
    }



    The error I am encountering is shown below. I know I can get by this by using the --force switch, but am trying to fix the dependencies so I don't have to.

    Why does "@angular/cdk@13.3.9" want to use "@angular/common@14.3.0"?

    npm update
    npm error code ERESOLVE
    npm error ERESOLVE unable to resolve dependency tree
    npm error
    npm error While resolving: app@2.3.1
    npm error Found: @angular/core@13.4.0
    npm error node_modules/@angular/core
    npm error @angular/core@"^13.4.0" from the root project
    npm error peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.9
    npm error node_modules/@angular/cdk
    npm error @angular/cdk@"^13.3.9" from the root project
    npm error
    npm error Could not resolve dependency:
    npm error peer @angular/core@"14.3.0" from @angular/common@14.3.0
    npm error node_modules/@angular/common
    npm error peer @angular/common@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.9
    npm error node_modules/@angular/cdk
    npm error @angular/cdk@"^13.3.9" from the root project
    npm error
    npm error Fix the upstream dependency conflict, or retry
    npm error this command with --force or --legacy-peer-deps
    npm error to accept an incorrect (and potentially broken) dependency resolution.
    npm error
    npm error

    Continue reading...

Compartilhe esta Página