xcarpentier/react-native-country-picker-modal

this package breaks npm install command

adamsythe opened this issue · 8 comments

Issue Description

i tried

yarn add react-native-country-picker-modal

Then i ran my app and everything worked great

However when i try add anything to npm install now it fails with the following error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myApp@0.0.1
npm ERR! Found: react@16.13.1
npm ERR! node_modules/react
npm ERR! react@"16.13.1" from the root project
npm ERR! peer react@"" from react-native-country-picker-modal@2.0.0
npm ERR! node_modules/react-native-country-picker-modal
npm ERR! react-native-country-picker-modal@"^2.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.1.0" from react-dom@18.1.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@"
" from react-native-country-picker-modal@2.0.0
npm ERR! node_modules/react-native-country-picker-modal
npm ERR! react-native-country-picker-modal@"^2.0.0" from the root project

I have the same problem

It seems like you are using react 16 and react-dom 18
react-dom@18 requires react@18 to function. So, you can either downgrade react-dom or upgrade react

I don't think the issue has anything to do with this library though. Alternatively, you can also ignore this behaviour of npm, which is not recommended, using

npm install --legacy-peer-deps

Same issue here.
I tried to upgrade react (version 17 to 18) but it still didn't work.
So, I decided to test with yarn and it worked fine. Seems like it just works with yarn.

when I run npm install react-native-country-picker-modal it doesn't work the installation fail, I want to know if i can't install via npm ??

when I run npm install react-native-country-picker-modal it doesn't work the installation fail, I want to know if i can't install via npm ??

I have successfully installed the package using yarn but I would like to know how I get values upon country selection ,

@xcarpentier thank you for your contribution. I have seen the bug mentioned here when using react 18. I was able to install it with npm install --legacy-peer-dep but then I have had some problems when I have tried to install another libraries. Is there a plan to fix it?

Use yarn to install "react-native-country-picker-modal" it will work.

Removing node_modules and package-lock.json then running npm install works for me