ERESOLVE 无法解析在 Angular 15 中安装 NgRx 时的依赖关系树

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

我目前在尝试在我的 Angular 15 项目中安装 NgRx 时遇到问题。

我正在使用一个命令:

 ng add @ngrx/store@latest      

我收到这个错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"~7.4.0" from the root project
npm ERR!   peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/core@"^15.2.0" from the root project
npm ERR!     peer @angular/core@"^15.0.0" from @ngrx/[email protected]
npm ERR!     node_modules/@ngrx/store
npm ERR!       @ngrx/store@"15.3.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.5.3 || ^7.5.0" from @ngrx/[email protected]
npm ERR! node_modules/@ngrx/store
npm ERR!   @ngrx/store@"15.3.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\MyUser\AppData\Local\npm-cache\eresolve-report.txt for a full 
report

我不是 100% 确定问题可能是什么,也许有人以前已经遇到过这个问题。

我正在使用最新的 Angular 版本

"@angular/animations": "^15.2.0",
"@angular/cdk": "^15.2.0",
"@angular/common": "^15.2.0",
"@angular/compiler": "^15.2.0",
"@angular/core": "^15.2.0",
"@angular/forms": "^15.2.0",

提前感谢任何帮助。

angular ngrx ngrx-store
2个回答
1
投票

你应该更新你的

rxjs
部门到至少
7.5
这是
@ngrx/[email protected]
所要求的。

另一种选择是强制安装

npm i --force


0
投票
npm i --save @ngrx/store@^15
npm i --save @ngrx/effects@^15
npm i --save @ngrx/store-devtools@^15
© www.soinside.com 2019 - 2024. All rights reserved.