I'm following the setup instructions from the React Native Documentation page, on my M1 Macbook Pro. I have previously worked on React projects and was able to create and run React Native Expo projects previously on the same machine.
I followed the instructions to the letter, but when I arrived at the 'Create A New Application" section, using the npx react-native init AwesomeProject
command, the new project creation failed. Here are the error message outputted on the Terminal:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native@0.66.4
npm ERR! node_modules/react-native
npm ERR! peer react-native@"*" from @react-native-community/cli@6.3.1
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"^6.0.0" from react-native@0.66.4
npm ERR! react-native@"0.69.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"0.69.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.0.0
npm ERR! node_modules/react
npm ERR! peer react@"18.0.0" from react-native@0.69.2
npm ERR! node_modules/react-native
npm ERR! react-native@"0.69.2" 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.
I tried to uninstall react-native and install it back but couldn't find a proper instruction on the net to do that. How can I just scrape the previously installed react-native (judging from the error message, i got RN@0.66.4, when I want to use the latest RN) and install a fresh, latest react native?