【发布时间】: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。
标签: angular typescript ionic-framework npm