I am trying to run npm install @react-navigation/native @react-navigation/native-stack
but end up receiving these errors when doing so:
npm WARN ERESOLVE overriding peer dependency
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^17.0.0" from [email protected]
npm ERR! node_modules/react-native-screens/node_modules/react-freeze
npm ERR! react-freeze@"^1.0.0" from [email protected]
npm ERR! node_modules/react-native-screens
npm ERR! peer react-native-screens@">= 3.0.0" from @react-navigation/[email protected]
npm ERR! node_modules/@react-navigation/native-stack
npm ERR! @react-navigation/native-stack@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@">=17.0.1" from [email protected]
npm ERR! node_modules/react-native-web
npm ERR! react-native-web@"^0.17.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@">=17.0.1" from [email protected]
npm ERR! node_modules/react-native-web
npm ERR! react-native-web@"^0.17.1" 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 /home/reptar/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/reptar/.npm/_logs/2022-06-15T11_49_30_010Z-debug-0.log
here is my package.json file:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.21.4",
"expo": "~42.0.1",
"expo-status-bar": "~1.0.4",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-select-dropdown": "^1.0.9",
"react-native-web": "^0.17.1"
},
"devDependencies": {
"@babel/core": "^7.9.0"
},
"private": true
}
Can someone walk me through on how to fix this? This is the thing I struggle the most with when I have to install or fix dependencies/packages.
============================UPDATE:
when I was trying to update react, I had to update react-dom at the same time or would get a similar error. So I ran npm i react@latest react-dom@latest
. then I would try to run the navigation install again and would get the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR! peer react@"*" from @react-navigation/[email protected]
npm ERR! node_modules/@react-navigation/native
npm ERR! @react-navigation/native@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"16.13.1" from [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz" from the root project
npm ERR! peer react-native@"*" from @react-navigation/[email protected]
npm ERR! node_modules/@react-navigation/native
npm ERR! @react-navigation/native@"*" 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.