尝试在Angular应用程序中安装NGRX时会出现错误
我正在尝试在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版本更新以及所有内容。但这无效。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于,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