我目前在尝试在我的 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",
提前感谢任何帮助。
npm i --save @ngrx/store@^15
npm i --save @ngrx/effects@^15
npm i --save @ngrx/store-devtools@^15