尝试在Angular应用程序中安装NGRX时会出现错误

发布于 2025-02-14 00:54:04 字数 2296 浏览 1 评论 0 原文

我正在尝试在Angular应用程序中安装NGRX。我已经执行了命令

ng添加 @ngrx/store @最新

,但会导致错误,如下所示,

NPM分辨率错误报告

2022-07-07T20:36:16.089z

解决方案时: [email  preconted] 找到: @angular/ node_modules/@angular/core @angular/core@“ 〜13.3.0”来自root项目

无法解决依赖性: peer @angular/core @“^14.0.0”来自 @ngrx/ email  partect  protected> node_modules/@ngrx/store @ngrx/store@“ 14.0.1”从根项目

修复上游依赖性冲突或重试 此命令带有 - 法或 - 掌控式deps 接受不正确(并可能破坏)依赖性解决方案。

RAW JSON解释对象:

{
  "code": "ERESOLVE",
  "current": {
    "name": "@angular/core",
    "version": "13.3.11",
    "whileInstalling": {
      "name": "crudapp",
      "version": "0.0.0",
      "path": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
    },
    "location": "node_modules/@angular/core",
    "dependents": [
      {
        "type": "prod",
        "name": "@angular/core",
        "spec": "~13.3.0",
        "from": {
          "location": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
        }
      }
    ]
  },
  "edge": {
    "type": "peer",
    "name": "@angular/core",
    "spec": "^14.0.0",
    "error": "INVALID",
    "from": {
      "name": "@ngrx/store",
      "version": "14.0.1",
      "whileInstalling": {
        "name": "crudapp",
        "version": "0.0.0",
        "path": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
      },
      "location": "node_modules/@ngrx/store",
      "dependents": [
        {
          "type": "prod",
          "name": "@ngrx/store",
          "spec": "14.0.1",
          "from": {
            "location": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
          }
        }
      ]
    }
  },
  "peerConflict": null,
  "strictPeerDeps": false,
  "force": false
}

任何人都能对此有任何想法吗?我尝试了一些Angular版本更新以及所有内容。但这无效。

I am trying to install ngrx in my Angular application. I have executed the command

ng add @ngrx/store@latest

But it results in an error as follows

npm resolution error report

2022-07-07T20:36:16.089Z

While resolving: [email protected]
Found: @angular/[email protected]
node_modules/@angular/core
@angular/core@"~13.3.0" from the root project

Could not resolve dependency:
peer @angular/core@"^14.0.0" from @ngrx/[email protected]
node_modules/@ngrx/store
@ngrx/store@"14.0.1" 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/core",
    "version": "13.3.11",
    "whileInstalling": {
      "name": "crudapp",
      "version": "0.0.0",
      "path": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
    },
    "location": "node_modules/@angular/core",
    "dependents": [
      {
        "type": "prod",
        "name": "@angular/core",
        "spec": "~13.3.0",
        "from": {
          "location": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
        }
      }
    ]
  },
  "edge": {
    "type": "peer",
    "name": "@angular/core",
    "spec": "^14.0.0",
    "error": "INVALID",
    "from": {
      "name": "@ngrx/store",
      "version": "14.0.1",
      "whileInstalling": {
        "name": "crudapp",
        "version": "0.0.0",
        "path": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
      },
      "location": "node_modules/@ngrx/store",
      "dependents": [
        {
          "type": "prod",
          "name": "@ngrx/store",
          "spec": "14.0.1",
          "from": {
            "location": "/home/Projects/Learning/Angular-ngrx-CRUD/angular-ngrx-crud"
          }
        }
      ]
    }
  },
  "peerConflict": null,
  "strictPeerDeps": false,
  "force": false
}

Can anyone have any idea about the same? I have tried with some angular version updations and all. But it doesn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

z祗昰~ 2025-02-21 00:54:05

问题在于,Angular和NGRX/Store的版本不同,您的项目使用Angular 13,而NGRX/Store试图找到Angular 14,因为您使用的是command @latest。解决方案是您可以尝试使用ng添加 @ngrx/store @13

The problem is there is a different version of angular and ngrx/store, your project uses angular 13, and the ngrx/store trying to find angular 14 because you are using command @latest. The solution is you can try to use ng add @ngrx/store@13

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文