Could not resolve peer dependency while installing a package

2.1k views Asked by At

I made an Angular 9 library with a few packages on it, but whenever I run an npm install one of the external packages throws the error below 'Could not resolve peer dependency @angular/common@"^8.2.6"'. I've tried installing with '--legacy-peer-deps' but that didn't do the trick since the package does not work anymore after installing it like that. Another thing to note is that in my client, also Angular 9, the install and the package worked fine. How does one overcome this error? npm Error

"dependencies": {
"@angular/animations": "~9.1.13",
"@angular/common": "~9.1.13",
"@angular/compiler": "~9.1.13",
"@angular/core": "~9.1.13",
"@angular/forms": "~9.1.13",
"@angular/platform-browser": "~9.1.13",
"@angular/platform-browser-dynamic": "~9.1.13",
"@angular/router": "~9.1.13",
"@mdi/font": "^5.1.45",
"@ng-bootstrap/ng-bootstrap": "^6.2.0",
"@schematics/angular": "^9.1.8",
"@txtextcontrol/tx-ng-document-editor": "^29.0.0",
"ecarelib": "0.0.402",
"rxjs": "~6.5.4",
"tslib": "^1.13.0",
"zone.js": "~0.10.2"},


"devDependencies": {
    "@angular-devkit/build-angular": "~0.901.15",
    "@angular-devkit/build-ng-packagr": "~0.901.15",
    "@angular/cli": "~9.1.15",
    "@angular/compiler-cli": "~9.1.13",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "ng-packagr": "^9.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
1

There are 1 answers

1
Mahdi Zarei On

run ng update. then run npm audit --fix. then run npm i. tell me if it worked.