0

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"
  }
Mahdi Zarei
  • 5,644
  • 7
  • 24
  • 54
r0699049
  • 93
  • 8
  • What do you mean by "the package does not work" in "the package does not work anymore after installing it like that"? What are you seeing that indicates the package is not working, and what makes you think it's tied to the `--legacy-peer-deps` flag? – Trott Apr 14 '21 at 11:56
  • I'm able to install errorless with the flag but when I try to build the library for production I get errors related to the package that's missing the peer dep (txtextcontrol) – r0699049 Apr 14 '21 at 12:07
  • What's the error? Are you sure it's related to the install and not something else? – Trott Apr 14 '21 at 13:28

1 Answers1

0

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

Mahdi Zarei
  • 5,644
  • 7
  • 24
  • 54