ngx-datatable ERESOLVE 无法解析依赖树
Posted
技术标签:
【中文标题】ngx-datatable ERESOLVE 无法解析依赖树【英文标题】:ngx-datatable ERESOLVE unable to resolve dependency tree 【发布时间】:2021-09-25 03:43:28 【问题描述】:我正在尝试在运行 Angular 12 的项目中安装 ngx-datatables npm install @swimlane/ngx-datatable 安装后出现以下错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: Optylab-project@0.0.1
npm ERR! Found: @angular/common@12.0.5
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~12.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^11.0.2" from @swimlane/ngx-datatable@19.0.0
npm ERR! node_modules/@swimlane/ngx-datatable
npm ERR! @swimlane/ngx-datatable@"^19.0.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.
我不明白这里需要做什么。
【问题讨论】:
这意味着:您的项目使用@angular/common@~12.0.x
,需要使用@swimlane/ngx-datatable@~19.0.x
的@angular/common@^11.x.x
(NOT 12)。 @angular/common
的版本没有重叠。所以只要 ngx-datatable
没有发布 angular 12,你的应用程序就会卡在 angular 11,除非你 force
安装 @swimlane/ngx-datatable@~19.0.x
。但是当您在其他地方签出项目时,您将不得不再次手动运行npm install --force @swimlane/ngx-datatable@19.0.0
。
【参考方案1】:
安装 @swimlane/ngx-datatable@20.0.0
对我有帮助
【讨论】:
【参考方案2】:主分支not updated to Angular 12 尚未。您可以尝试使用--force
flag::
npm i @swimlane/ngx-datatable --save --force
【讨论】:
没什么变化我仍然无法从 '@swimlane/ngx-datatable' 导入 NgxDatatableModule ;此命令未在 nodemodule 中安装 ngxdtable @oussema-kallel 你有以前的错误吗? 我得到了最新信息,在 12 秒内审核了 1673 个包 131 个包正在寻找资金 运行npm fund
了解详细信息 5 个中等严重性漏洞 一些问题需要审查,并且可能需要选择不同的依赖项。
@oussema-kallel 你是对的。我更新了我的答案。您可以尝试再安装一次。以上是关于ngx-datatable ERESOLVE 无法解析依赖树的主要内容,如果未能解决你的问题,请参考以下文章