0

我制作了一个 Angular 9 库,上面有几个包,但是每当我运行 npm install 时,其中一个外部包都会在“无法解析对等依赖项@angular/common@”^8.2.6“”下方抛出错误。我尝试使用“--legacy-peer-deps”进行安装,但这并没有成功,因为在安装后该软件包不再起作用。需要注意的另一件事是,在我的客户端(也是 Angular 9)中,安装和包运行良好。如何克服这个错误? npm 错误

"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"
  }
4

1 回答 1

0

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

于 2021-04-14T11:37:50.100 回答