安装软件包时无法解析对等依赖项

时间:2021-04-14 11:32:08

标签: angular npm dependencies txtextcontrol

我制作了一个带有几个包的 Angular 9 库,但是每当我运行 npm install 时,其中一个外部包会抛出以下错误“无法解析对等依赖@angular/common@"^8.2.6"” . 我试过使用“--legacy-peer-deps”进行安装,但这并没有奏效,因为这样安装后该软件包不再起作用。另一件需要注意的事情是,在我的客户端中,也是 Angular 9,安装和包运行良好。如何克服这个错误? 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 个答案:

答案 0 :(得分:0)

运行ng update。 然后运行npm audit --fix。 然后运行npm i。 告诉我它是否有效。