需要帮助解决 npm 问题 eresolve 报告

Need Help resolving npm issues eresolve report

我在执行简单的 npm 安装时遇到问题。我正在使用 angular 最新的 cli 版本。 我已重新安装 angular、node 和 npm,但似乎无法解决这些问题。

这是我的 eresolve 报告:

While resolving: fsl-angular-task@0.0.0
Found: @angular/common@11.2.14
node_modules/@angular/common
  @angular/common@"~11.2.14" from the root project

Could not resolve dependency:
peer @angular/common@"^13.0.0 || ^14.0.0-0" from @angular/cdk@13.3.7
node_modules/@angular/cdk
  @angular/cdk@"^13.3.7" 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.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "@angular/common",
    "version": "11.2.14",
    "whileInstalling": {
      "name": "fsl-angular-task",
      "version": "0.0.0",
      "path": "<cant show directory>"
    },
    "location": "node_modules/@angular/common",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "prod",
        "name": "@angular/common",
        "spec": "~11.2.14",
        "from": {
          "location": "<cant show directory>"
        }
      }
    ]
  },
  "currentEdge": {
    "type": "prod",
    "name": "@angular/common",
    "spec": "~11.2.14",
    "from": {
      "location": "C:\<cant show directory>"
    }
  },
  "edge": {
    "type": "peer",
    "name": "@angular/common",
    "spec": "^13.0.0 || ^14.0.0-0",
    "error": "INVALID",
    "from": {
      "name": "@angular/cdk",
      "version": "13.3.7",
      "whileInstalling": {
        "name": "fsl-angular-task",
        "version": "0.0.0",
        "path": "C:\<cant show directory>"
      },
      "location": "node_modules/@angular/cdk",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "prod",
          "name": "@angular/cdk",
          "spec": "^13.3.7",
          "from": {
            "location": "<cant show directory>"
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

有没有人可以帮忙,谢谢 〗

您使用的是哪个 npmnode 版本?我相信升级到较新的节点版本可能会解决问题。

发生此错误是因为您正在尝试安装有冲突的包:

@angular/common@"~11.2.14" from the root project
// and
@angular/common@"^13.0.0 || ^14.0.0-0"

尝试添加 --legacy-peer-deps 标志,这不是真正推荐的做法,但可能会忽略您的问题。