Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Error while initialising new project

I am getting following error when I try to run command

npx react-native init AwesomeProject

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: [email protected] npm ERR! node_modules/react-native npm ERR! peer react-native@"*" from @react-native-community/[email protected] npm ERR!
node_modules/@react-native-community/cli npm ERR!
@react-native-community/cli@"^7.0.3" from [email protected] npm ERR! react-native@"0.69.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! react-native@"0.69.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peer react@"18.0.0" from [email protected] npm ERR! node_modules/react-native npm ERR!
react-native@"0.69.0" 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! npm ERR! See C:\Users\NIMASHA NAIK\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\NIMASHA NAIK\AppData\Local\npm-cache_logs\2022-06-23T13_40_58_714Z-debug-0.log

Please can anyone help?

Thank You.

like image 723
Nimisha geek Avatar asked Jul 08 '26 22:07

Nimisha geek


2 Answers

Removing the ~/.npm cache folder worked for me

rm -r ~/.npm

like image 144
Mario Jimenez Avatar answered Jul 11 '26 15:07

Mario Jimenez


I had the same problem so I did it

npm config set legacy-peer-deps true
npx react-native

try it worked.

like image 26
Zibu Avatar answered Jul 11 '26 15:07

Zibu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!