Angular 17:当对等依赖发生冲突时如何解决依赖?

问题描述 投票:0回答:1

我使用

npm --force
将 Angular 升级到版本 17,该应用程序在本地运行良好,但是当我尝试部署它(章鱼部署)时,.Net 自动执行 npm 安装,并且执行停止并出现冲突列表。我尝试用
npm install
替换命令
npm install --force
但没有成功。

有人可以解释一下一般如何解决此类冲突或分享一些文档吗?

请问如何解决以下冲突?

# npm resolution error report

While resolving: @angular-eslint/[email protected]
Found: [email protected]
node_modules/eslint
  dev eslint@"^9.2.0" from the root project
  peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/[email protected]
  node_modules/@eslint-community/eslint-utils
    @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
    node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/utils
      @typescript-eslint/utils@"7.8.0" from @angular-eslint/[email protected]
      node_modules/@angular-eslint/eslint-plugin
        dev @angular-eslint/eslint-plugin@"17.4.0" from the root project
        @angular-eslint/eslint-plugin@"17.4.0" from @angular-eslint/[email protected]
        node_modules/@angular-eslint/schematics
          dev @angular-eslint/schematics@"17.4.0" from the root project
      @typescript-eslint/utils@"7.8.0" from @angular-eslint/[email protected]
      node_modules/@angular-eslint/eslint-plugin/node_modules/@angular-eslint/utils
        @angular-eslint/utils@"17.4.0" from @angular-eslint/[email protected]
        node_modules/@angular-eslint/eslint-plugin
          dev @angular-eslint/eslint-plugin@"17.4.0" from the root project
          @angular-eslint/eslint-plugin@"17.4.0" from @angular-eslint/[email protected]
          node_modules/@angular-eslint/schematics
            dev @angular-eslint/schematics@"17.4.0" from the root project
    @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
    node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/utils
      @typescript-eslint/utils@"7.8.0" from @angular-eslint/[email protected]
      node_modules/@angular-eslint/eslint-plugin-template
        dev @angular-eslint/eslint-plugin-template@"17.4.0" from the root project
        @angular-eslint/eslint-plugin-template@"17.4.0" from @angular-eslint/[email protected]
        node_modules/@angular-eslint/schematics
          dev @angular-eslint/schematics@"17.4.0" from the root project
      @typescript-eslint/utils@"7.8.0" from @angular-eslint/[email protected]
      node_modules/@angular-eslint/eslint-plugin-template/node_modules/@angular-eslint/utils
        @angular-eslint/utils@"17.4.0" from @angular-eslint/[email protected]
        node_modules/@angular-eslint/eslint-plugin-template
          dev @angular-eslint/eslint-plugin-template@"17.4.0" from the root project
          @angular-eslint/eslint-plugin-template@"17.4.0" from @angular-eslint/[email protected]
          node_modules/@angular-eslint/schematics
            dev @angular-eslint/schematics@"17.4.0" from the root project
      @typescript-eslint/utils@"7.8.0" from @typescript-eslint/[email protected]
      node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/type-utils
        @typescript-eslint/type-utils@"7.8.0" from @angular-eslint/[email protected]
        node_modules/@angular-eslint/eslint-plugin-template
          dev @angular-eslint/eslint-plugin-template@"17.4.0" from the root project
          @angular-eslint/eslint-plugin-template@"17.4.0" from @angular-eslint/[email protected]
          node_modules/@angular-eslint/schematics
            dev @angular-eslint/schematics@"17.4.0" from the root project
    @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
    node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils
      @typescript-eslint/utils@"7.8.0" from @typescript-eslint/[email protected]
      node_modules/@typescript-eslint/eslint-plugin
        dev @typescript-eslint/eslint-plugin@"^7.8.0" from the root project
      @typescript-eslint/utils@"7.8.0" from @typescript-eslint/[email protected]
      node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/type-utils
        @typescript-eslint/type-utils@"7.8.0" from @typescript-eslint/[email protected]
        node_modules/@typescript-eslint/eslint-plugin
          dev @typescript-eslint/eslint-plugin@"^7.8.0" from the root project
    @eslint-community/eslint-utils@"^4.2.0" from [email protected]

Could not resolve dependency:
peer eslint@"^7.20.0 || ^8.0.0" from @angular-eslint/[email protected]
node_modules/@angular-eslint/builder
  dev @angular-eslint/builder@"17.4.0" from the root project

Conflicting peer dependency: [email protected]
node_modules/eslint
  peer eslint@"^7.20.0 || ^8.0.0" from @angular-eslint/[email protected]
  node_modules/@angular-eslint/builder
    dev @angular-eslint/builder@"17.4.0" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

这是package.json

"dependencies": {
    "@angular/animations": "~17.3.8",
    "@angular/cdk": "^17.3.9",
    "@angular/common": "~17.3.8",
    "@angular/compiler": "~17.3.8",
    "@angular/core": "~17.3.8",
    "@angular/forms": "~17.3.8",
    "@angular/localize": "~17.3.8",
    "@angular/platform-browser": "~17.3.8",
    "@angular/platform-browser-dynamic": "~17.3.8",
    "@angular/platform-server": "~17.3.8",
    "@angular/router": "~17.3.8",
    "@fortawesome/angular-fontawesome": "^0.14.1",
    "@fortawesome/fontawesome-common-types": "^6.5.2",
    "@fortawesome/fontawesome-svg-core": "^6.5.2",
    "@ngx-translate/core": "^15.0.0",
    "@ngx-translate/http-loader": "^8.0.0",
    "@progress/kendo-angular-buttons": "^15.5.0",
    "@progress/kendo-angular-common": "^15.5.0",
    "@progress/kendo-angular-dateinputs": "^15.5.0",
    "@progress/kendo-angular-dialog": "^15.5.0",
    "@progress/kendo-angular-dropdowns": "^15.5.0",
    "@progress/kendo-angular-excel-export": "^15.5.0",
    "@progress/kendo-angular-grid": "^15.5.0",
    "@progress/kendo-angular-icons": "^15.5.0",
    "@progress/kendo-angular-indicators": "^15.5.0",
    "@progress/kendo-angular-inputs": "^15.5.0",
    "@progress/kendo-angular-intl": "^15.5.0",
    "@progress/kendo-angular-l10n": "^15.5.0",
    "@progress/kendo-angular-label": "^15.5.0",
    "@progress/kendo-angular-layout": "^15.5.0",
    "@progress/kendo-angular-listview": "^15.5.0",
    "@progress/kendo-angular-menu": "^15.5.0",
    "@progress/kendo-angular-navigation": "^15.5.0",
    "@progress/kendo-angular-notification": "^15.5.0",
    "@progress/kendo-angular-pager": "^15.5.0",
    "@progress/kendo-angular-pdf-export": "^15.5.0",
    "@progress/kendo-angular-popup": "^15.5.0",
    "@progress/kendo-angular-progressbar": "^15.5.0",
    "@progress/kendo-angular-ripple": "^15.5.0",
    "@progress/kendo-angular-tooltip": "^15.5.0",
    "@progress/kendo-angular-treeview": "^15.5.0",
    "@progress/kendo-data-query": "^1.7.0",
    "@progress/kendo-drawing": "^1.20.1",
    "@progress/kendo-font-icons": "^3.0.0",
    "@progress/kendo-licensing": "^1.3.5",
    "@progress/kendo-svg-icons": "^3.0.0",
    "@progress/kendo-theme-default": "^8.0.1",
    "@types/lodash": "^4.17.1",
    "angular-oauth2-oidc": "^17.0.2",
    "bootstrap": "^5.3.3",
    "cldr-core": "^45.0.0",
    "cldr-dates-full": "^45.0.0",
    "cldr-numbers-full": "^45.0.0",
    "jquery": "^3.7.1",
    "kendo-ui-license": "^1.0.1",
    "locale-codes": "^1.3.1",
    "npm-check-updates": "^16.14.20",
    "oidc-client": "^1.11.5",
    "popper.js": "^1.16.0",
    "run-script-os": "^1.1.6",
    "rxjs": "~7.8.1",
    "zone.js": "~0.14.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~17.3.7",
    "@angular-eslint/builder": "17.4.0",
    "@angular-eslint/eslint-plugin": "17.4.0",
    "@angular-eslint/eslint-plugin-template": "17.4.0",
    "@angular-eslint/schematics": "17.4.0",
    "@angular-eslint/template-parser": "17.4.0",
    "@angular/cli": "~17.3.7",
    "@angular/compiler-cli": "~17.3.8",
    "@types/jasmine": "~5.1.4",
    "@types/jasminewd2": "~2.0.13",
    "@types/jquery": "^3.5.30",
    "@types/node": "^20.12.11",
    "@typescript-eslint/eslint-plugin": "^7.8.0",
    "@typescript-eslint/parser": "^7.8.0",
    "eslint": "^9.2.0",
    "jasmine-core": "~5.1.2",
    "karma": "~6.4.3",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.1",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.1.0",
    "ngx-translate-testing": "^7.0.0",
    "tslib": "^2.6.2",
    "typescript": "^5.4.5"
  }
}
.net angular typescript npm octopus-deploy
1个回答
-1
投票

首先全局安装该版本的 Angular cli

~17.3.7

npm i @angular/cli@~17.3.7 -g

然后使用

创建一个新的角度项目
ng new test

然后开始将所有依赖项一一安装到这个项目中

这将为您提供正确的版本来克服依赖地狱,然后将值复制粘贴到您的项目中,这可能会解决您的问题!或者至少缩小它的大小!

祝一切顺利!

© www.soinside.com 2019 - 2024. All rights reserved.