xcarpentier / react-native-country-picker-modal

🇦🇶 Country picker provides a modal allowing a user to select a country from a list. It display a flag next to each country name.
https://reactnative.gallery/xcarpentier/country-picker
MIT License
1.07k stars 796 forks source link

this package breaks npm install command #468

Open adamsythe opened 2 years ago

adamsythe commented 2 years ago

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

alberttoledo commented 2 years ago

I have the same problem

RikTheGuy commented 2 years ago

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

Tamar-J commented 2 years ago

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.

kofesto commented 1 year ago

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 ??

kofesto commented 1 year ago

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 ,

mariovillamizar commented 1 year ago

@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?

nshadazhr commented 1 year ago

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

JakeTylerSimon commented 5 months ago

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