devfolioco / react-otp-input

:heavy_check_mark: OTP Input Component for React
http://devfolioco.github.io/react-otp-input
MIT License
663 stars 426 forks source link

dependency error: Not working with react 17 #295

Closed alireza-sharifpour closed 1 year ago

alireza-sharifpour commented 3 years ago

I just want to install this package and i got dependency error:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: x@0.1.0 npm ERR! Found: react@17.0.2 npm ERR! node_modules/react npm ERR! react@"17.0.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.2.0" from react-otp-input@2.3.1

i used --legacy-peer-deps but i just wanted to inform you.

darkmatter18 commented 3 years ago

Same here

EdwardMovsesyan91 commented 3 years ago

Same here

daryl-07 commented 3 years ago

Same here (2)

pragati9 commented 3 years ago

same issue

avinash-wissen commented 3 years ago

same issue

EmmanuelAmodu commented 3 years ago

Temporary fix https://www.npmjs.com/package/react-otp-input-rc-17 npm i react-otp-input-rc-17

JPStrydom commented 2 years ago

Could we not simply bump the peer dependencies to:

 "peerDependencies": {
    "react": "^17.0.0",
    "react-dom": "^17.0.0"
  },

?

ritikbanger commented 2 years ago

The feature is available in: https://www.npmjs.com/package/react18-input-otp

shtbik commented 1 year ago

You can resolve it manually in the package.json with the overrides rule for npm (>=8) or with resolutions for yarn:

NPM example:

"overrides": {
    "react-otp-input": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
 }

p.s. should work for react@18 as well

ritikbanger commented 1 year ago

Hello @shtbik Please go with this new package: https://www.npmjs.com/package/react18-input-otp

prateek3255 commented 1 year ago

v3 now works with React 17 and 18