【发布时间】:2021-08-08 18:46:08
【问题描述】:
我在执行“npm i ngx-slick-carousel --save”时遇到错误
我的版本是:
$ npm -v
7.6.1
$ node -v
v14.17.0
Angular CLI: 11.2.13
错误是:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: irt-official@0.0.0
npm ERR! Found: @angular/common@11.2.14
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~11.2.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^7.0.0 || ^8.0.0 || ^9.0.0" from ngx-slick-carousel@0.5.1
npm ERR! node_modules/ngx-slick-carousel
npm ERR! ngx-slick-carousel@"*" 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\malik\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\malik\AppData\Local\npm-cache\_logs\2021-05-19T14_13_57_035Z-debug.log
package.json:
"@angular/animations": "~11.2.13",
"@angular/common": "~11.2.13",
"@angular/compiler": "~11.2.13",
"@angular/core": "~11.2.13",
"@angular/forms": "~11.2.13",
"@angular/platform-browser": "~11.2.13",
"@angular/platform-browser-dynamic": "~11.2.13",
"@angular/router": "~11.2.13",
"angular-animations": "^0.11.0",
"jquery": "^3.6.0",
"rxjs": "~6.6.0",
"slick-carousel": "^1.8.1",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
请帮我解决这个问题。为什么我无法安装这个。谢谢
更新 1:
我已删除 node_module 和 packagelock.json 文件并尝试执行“npm install”,但现在出现此错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: irt-official@0.0.0
npm ERR! Found: @angular/core@11.2.14
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"~11.2.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"12.0.1" from @angular/animations@12.0.1
npm ERR! node_modules/@angular/animations
npm ERR! peer @angular/animations@">=6.0.0" from angular-animations@0.11.0
npm ERR! node_modules/angular-animations
npm ERR! angular-animations@"^0.11.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\malik\AppData\Local\npm-cache\eresolve-report.txt
获取完整报告。
更新 2:
我已经完成“npm install --legacy-peer-deps”这个命令安装了我的 node_module,但是当我在安装后执行“ng serve”时,我收到了这个错误
发生未处理的异常:目标入口点“@angular/platform-browser/animations”缺少依赖项:
- @angular/动画
- @angular/animations/browser
更新 3:
我已经完全刷新了所有东西,比如我已经卸载了 node 和 angular cli 并重新安装了
节点版本16.2.0
npm -v: 7.6.1
Angular CLI:12.0.1
现在我创建了新项目“ng new IRT-Official” 然后我再次尝试执行“npm install ngx-slick-carousel --save” 现在我收到此错误。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: irt-official@0.0.0
npm ERR! Found: @angular/common@12.0.1
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@"^7.0.0 || ^8.0.0 || ^9.0.0" from ngx-slick-carousel@0.5.1
npm ERR! node_modules/ngx-slick-carousel
npm ERR! ngx-slick-carousel@"*" 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
更新 4:
我在我的 packege.json 文件中手动添加了“ngx-slick-carousel”:“0.5.1”,然后“npm install --legacy-peer-deps”它安装了 crousal,但是当我完成所有步骤时,我收到类似的错误
未捕获的类型错误:$(...).owlCarousel 不是函数
【问题讨论】:
-
好的,我要编辑并以文本形式分享
-
@MauricioGraciaGutierrez 我已经尝试运行“npm install --legacy-peer-deps”但仍然出现同样的错误
-
尝试以下“npm install @angular/animations@latest --save”,每当您遇到新错误时,请在 SO 或 google 中查找 - stackoverflow.com/questions/42857345/… - 从一个错误转移到另一个错误是进展
-
@MauricioGraciaGutierrez 请检查有问题的更新 3。
标签: angular npm-install