javascriptreactjsnpmnpm-installreact-otp-input

Could not resolve dependency. While resolving: react-otp-input@2.4.0 12:15:56 AM: npm ERR! Found: react@18.2.0. Below is the deploy log on netlify


12:15:54 AM: Installing npm packages using npm version 8.19.3

12:15:56 AM: npm ERR! code ERESOLVE

12:15:56 AM: npm ERR! ERESOLVE could not resolve

12:15:56 AM: npm ERR!

12:15:56 AM: npm ERR! While resolving: react-otp-input@2.4.0

12:15:56 AM: npm ERR! Found: react@18.2.0

12:15:56 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)

12:15:56 AM: npm ERR! node_modules/react

12:15:56 AM: npm ERR! react@"^18.1.0" from the root project

12:15:56 AM: npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0

12:15:56 AM: npm ERR! node_modules/@testing-library/react

12:15:56 AM: npm ERR! @testing-library/react@"^13.3.0" from the root project

12:15:56 AM: npm ERR! 9 more (formik, react-animation-on-scroll, react-dom, ...)

12:15:56 AM: npm ERR!

12:15:56 AM: npm ERR! Could not resolve dependency:

12:15:56 AM: npm ERR! peer react@"^16.2.0" from react-otp-input@2.4.0

12:15:56 AM: npm ERR! node_modules/react-otp-input

12:15:56 AM: npm ERR! react-otp-input@"^2.4.0" from the root project

12:15:56 AM: npm ERR!

12:15:56 AM: npm ERR! Conflicting peer dependency: react@16.14.0

12:15:56 AM: npm ERR! node_modules/react

12:15:56 AM: npm ERR! peer react@"^16.2.0" from react-otp-input@2.4.0

12:15:56 AM: npm ERR! node_modules/react-otp-input

12:15:56 AM: npm ERR! react-otp-input@"^2.4.0" from the root project

12:15:56 AM: npm ERR!

12:15:56 AM: npm ERR! Fix the upstream dependency conflict, or retry

12:15:56 AM: npm ERR! this command with --force, or --legacy-peer-deps

12:15:56 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.


Solution

  • the only solution up to now is to set --force flag, as below:

    npm i react-otp-input --force