Prince Agrawal
Prince Agrawal

Reputation: 410

npm ci passing locally but failed on gitlab

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.

Upvotes: 2

Views: 2654

Answers (1)

Mbuotidem Isaac
Mbuotidem Isaac

Reputation: 904

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 :

npm ci --legacy-peer-deps

Upvotes: 4

Related Questions