npm ci 在本地通过但在 gitlab 上失败
在 npm ci
命令期间出现此错误,但它在本地工作正常(尝试删除 node_modules 并运行 npm ci
重新安装它,没有错误)
$ npm ci
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @use-it/[email protected]
npm WARN Found: [email protected]
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/[email protected]
npm WARN node_modules/@use-it/event-listener
npm WARN @use-it/event-listener@"^0.1.2" from [email protected]
npm WARN node_modules/use-dark-mode
npm WARN 1 more (use-persisted-state)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @use-it/[email protected]
npm WARN node_modules/@use-it/event-listener
npm WARN @use-it/event-listener@"^0.1.2" from [email protected]
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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
npm ERR! node_modules/@ant-design/icons
npm ERR! @ant-design/icons@"^4.7.0" from [email protected]
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 [email protected]
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: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^16.8.0" from [email protected]
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!
提前致谢。
Getting this error during npm ci
command, but it is working fine locally (tried removing node_modules and running npm ci
to reinstall it, no errors)
$ npm ci
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @use-it/[email protected]
npm WARN Found: [email protected]
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/[email protected]
npm WARN node_modules/@use-it/event-listener
npm WARN @use-it/event-listener@"^0.1.2" from [email protected]
npm WARN node_modules/use-dark-mode
npm WARN 1 more (use-persisted-state)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @use-it/[email protected]
npm WARN node_modules/@use-it/event-listener
npm WARN @use-it/event-listener@"^0.1.2" from [email protected]
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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
npm ERR! node_modules/@ant-design/icons
npm ERR! @ant-design/icons@"^4.7.0" from [email protected]
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 [email protected]
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: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^16.8.0" from [email protected]
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!
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Gitlab 上的运行程序可能使用较新版本的 npm,而当遇到这种对等依赖错误时,较新版本的 npm 会失败。为了解决这个问题,我尝试使用
--legacy-peer-deps
标志运行它。这个答案有更多内容:https://stackoverflow.com/a/66035709。所以运行:The runner on Gitlab is likely using a newer version of npm and newer versions of npm fail when they encounter this kind of peer dependency error. To fix, I'd try to run it with the
--legacy-peer-deps
flag. This answer has more : https://stackoverflow.com/a/66035709. So run :