使用 Angular 13 安装 ngrx 存储时出现错误,无法解析依赖关系树
ERROR unable to resolve dependency tree when installing ngrx store with Angular 13
我在使用此命令时遇到问题:
ng add @ngrx/store@latest
我收到这个错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ngstore-app@0.0.0
npm ERR! Found: @angular/core@13.0.0
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"~13.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^12.0.0" from @ngrx/store@12.5.1
npm ERR! node_modules/@ngrx/store
npm ERR! @ngrx/store@"12.5.1" 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 ...\AppData\Local\npm-cache\eresolve-report.txt for a full report.
Versions tha I am using:
Angular CLI: 13.0.1
Node: 16.13.0
Package Manager: npm 8.1.3
知道导致问题的原因以及解决方法吗?
您的 @angular/core
版本为 13,但 @ngrx/store
支持到 Angular 12。
如果您安装 latest
标签,它将获取 12.5.1
,这在您的情况下不起作用。
你应该考虑ng add @ngrx/store@next
抢版本13.0.0-beta.0
你可以用 npm show @ngrx/store
查看所有内容
dist-tags:
beta: 6.0.0-beta.2 latest: 12.5.1 next: 13.0.0-beta.0 v8-lts: 8.6.1 v9-lts: 9.2.1
您可以轻松使用此命令:
npm install --legacy-peer-deps
我在使用此命令时遇到问题:
ng add @ngrx/store@latest
我收到这个错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ngstore-app@0.0.0
npm ERR! Found: @angular/core@13.0.0
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"~13.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^12.0.0" from @ngrx/store@12.5.1
npm ERR! node_modules/@ngrx/store
npm ERR! @ngrx/store@"12.5.1" 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 ...\AppData\Local\npm-cache\eresolve-report.txt for a full report.
Versions tha I am using:
Angular CLI: 13.0.1
Node: 16.13.0
Package Manager: npm 8.1.3
知道导致问题的原因以及解决方法吗?
您的 @angular/core
版本为 13,但 @ngrx/store
支持到 Angular 12。
如果您安装 latest
标签,它将获取 12.5.1
,这在您的情况下不起作用。
你应该考虑ng add @ngrx/store@next
抢版本13.0.0-beta.0
你可以用 npm show @ngrx/store
dist-tags:
beta: 6.0.0-beta.2 latest: 12.5.1 next: 13.0.0-beta.0 v8-lts: 8.6.1 v9-lts: 9.2.1
您可以轻松使用此命令:
npm install --legacy-peer-deps