Home > Mobile >  Dependency issue while upgrading to Angular 9 for jodit-angular
Dependency issue while upgrading to Angular 9 for jodit-angular

Time:10-31

Getting the below error while trying to run the command npm install after the angular migration to version 9.

Error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   peer zone.js@"~0.10.3" from @angular/[email protected]
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/core@"^9.1.13" from the root project
npm ERR!     peer @angular/core@"9.1.13" from @angular/[email protected] 
npm ERR!     node_modules/@angular/animations
npm ERR!       @angular/animations@"^9.1.13" from the root project       
npm ERR!       2 more (@angular/platform-browser, jodit-angular)
npm ERR!     11 more (@angular/cdk, @angular/common, @angular/forms, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer zone.js@"~0.9.1" from [email protected]
npm ERR! node_modules/jodit-angular
npm ERR!   jodit-angular@"1.9.4" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   peer zone.js@"~0.9.1" from [email protected]
npm ERR!   node_modules/jodit-angular
npm ERR!     jodit-angular@"1.9.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

npm ERR! A complete log of this run can be found in:

I have added the required zone.js deps version and updated the jodit-angular as below.

The current version of node.js is 16.17.1

Package.json

  {
  "name": "Angular App",
  "version": "0.0.0",
  "engines": {
    "node": ">=16.0.0"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^9.1.13",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "^9.1.13",
    "@angular/compiler": "^9.1.13",
    "@angular/core": "^9.1.13",
    "@angular/forms": "^9.1.13",
    "@angular/localize": "^9.1.13",
    "@angular/platform-browser": "^9.1.13",
    "@angular/platform-browser-dynamic": "^9.1.13",
    "@angular/router": "^9.1.13",
    "@ng-bootstrap/ng-bootstrap": "^6.2.0",
    "@types/lodash": "^4.14.134",
    "core-js": "^2.6.5",
    "date-fns": "^1.29.0",
    "decimal.js": "^10.2.0",
    "rxjs": "~6.6.7",
    "tslib": "^1.10.0",
    "typeface-open-sans": "0.0.54",
    "jodit-angular": "1.9.4",
    "jsonpath": "^1.0.1",
    "karma-parallel": "^0.3.1",
    "ng-bullet": "^1.0.3",
    "ngx-cookie": "~5.0.2",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.15",
    "@angular/cli": "^9.1.15",
    "@angular/compiler-cli": "^9.1.13",
    "karma-jasmine-html-reporter": "1.7.0",
    "karma-junit-reporter": "2.0.1",
    "protractor": "~5.4.0",
    "puppeteer": "^1.17.0",
    "sonar-scanner": "^3.1.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.8.3",
    "@angular/language-service": "^9.1.13",
    "@types/date-fns": "^2.6.0",
    "@types/jasmine": "3.3.0",
    "@types/jasminewd2": "2.0.10",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "https-proxy-agent": "^2.2.1",
    "jasmine-core": "3.9.0",
    "jasmine-spec-reporter": "7.0.0",
    "karma": "4.4.1",
    "karma-chrome-launcher": "3.1.1",
    "karma-coverage-istanbul-reporter": "3.0.3",
    "karma-jasmine": "3.3.0",
  },
  "optionalDependencies": {
    "fsevents": "^2.1.2"
  }
}

Any help is appreciated. Thanks in advance

CodePudding user response:

The error message says that [email protected] requires zone.js@~0.9.1, however you've specified zone.js@~0.10.3 in your configuration.

Therefore, the solution is to downgrade the Zone.js version in your package.json:

{
  ...
  "dependencies": {
    ...
    "zone.js": "~0.9.1"
  }
}

Alternatively, if you insist on an incompatible version of Zone.js and want to override the corresponding dependency of jodit-angular, you can do that in your package.json:

{
  ...
  "overrides": {
    "jodit-angular": {
      "zone.js": "$zone.js" // means: use the version from my project instead of the one you want
    }
  }
}

CodePudding user response:

One of the solution would be to remove both [email protected] and zone.js@~0.10.3 from your package.json and try npm install. After installation of npm, you can then add them manually to your project with the latest version.

npm i [email protected]

npm i [email protected]

  • Related