-1

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: jodit-angular@1.9.4
npm ERR! Found: zone.js@0.10.3
npm ERR! node_modules/zone.js
npm ERR!   peer zone.js@"~0.10.3" from @angular/core@9.1.13
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/animations@9.1.13 
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 jodit-angular@1.9.4
npm ERR! node_modules/jodit-angular
npm ERR!   jodit-angular@"1.9.4" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: zone.js@0.9.1
npm ERR! node_modules/zone.js
npm ERR!   peer zone.js@"~0.9.1" from jodit-angular@1.9.4
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

Newbie
  • 1,403
  • 2
  • 13
  • 22

3 Answers3

0

The error message says that jodit-angular@1.9.4 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
    }
  }
}
skink
  • 5,133
  • 6
  • 37
  • 58
0

One of the solution would be to remove both jodit-angular@1.9.4 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 jodit-angular@1.12.5

npm i zone.js@0.10.3

0

There is an issue with the version of the jodit-angular@1.9.4. Currently, jodit-angular developers removed the support for this library. So the only option is to upgrade the Angular version to 10 or we can fix the jodit-angular library issues and push the changes.

Newbie
  • 1,403
  • 2
  • 13
  • 22