首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm局部通过,但在gitlab上失败

npm局部通过,但在gitlab上失败
EN

Stack Overflow用户
提问于 2022-04-04 12:51:12
回答 1查看 762关注 0票数 0

npm ci命令中获取此错误,但它在本地工作正常(尝试删除node_modules并运行npm ci重新安装它,没有错误)

代码语言:javascript
复制
$ npm ci
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @use-it/event-listener@0.1.6
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from the root project
npm WARN   193 more (@ant-design/icons, @ant-design/react-slick, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @use-it/event-listener@0.1.6
npm WARN node_modules/@use-it/event-listener
npm WARN   @use-it/event-listener@"^0.1.2" from use-dark-mode@2.3.1
npm WARN   node_modules/use-dark-mode
npm WARN   1 more (use-persisted-state)
npm WARN 
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0" from @use-it/event-listener@0.1.6
npm WARN   node_modules/@use-it/event-listener
npm WARN     @use-it/event-listener@"^0.1.2" from use-dark-mode@2.3.1
npm WARN     node_modules/use-dark-mode
npm WARN     1 more (use-persisted-state)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: use-dark-mode@2.3.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peer react@">=16.0.0" from @ant-design/icons@4.7.0
npm ERR!   node_modules/@ant-design/icons
npm ERR!     @ant-design/icons@"^4.7.0" from antd@4.19.3
npm ERR!     node_modules/antd
npm ERR!       antd@"^4.19.3" from the root project
npm ERR!   192 more (@ant-design/react-slick, @apollo/client, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from use-dark-mode@2.3.1
npm ERR! node_modules/use-dark-mode
npm ERR!   use-dark-mode@"^2.3.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from use-dark-mode@2.3.1
npm ERR!   node_modules/use-dark-mode
npm ERR!     use-dark-mode@"^2.3.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!

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-04-22 21:32:27

Gitlab上的运行程序可能会在遇到这种对等依赖错误时使用新版本的npm,而新版本的npm则会失败。为了解决这个问题,我尝试使用--legacy-peer-deps标志来运行它。这个答案有更多:https://stackoverflow.com/a/66035709。所以跑:

代码语言:javascript
复制
npm ci --legacy-peer-deps
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71737553

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档