In React Native application to make a navigation need to install @react-navigation/stack using npm install @react-navigation/stack
and I have tried it and failed each and every times.
NPM version: 7.19.1
Node version: v15.14.0
Expo version: 4.8.1
After running npm install @react-navigation/stack
this command I have faced the below error is given,
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @react-navigation/native@3.8.4
npm ERR! node_modules/@react-navigation/native
npm ERR! @react-navigation/native@"^3.8.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @react-navigation/native@"^6.0.0" from @react-navigation/stack@6.0.1
npm ERR! node_modules/@react-navigation/stack
npm ERR! @react-navigation/stack@"*" 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/imdadul/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/imdadul/.npm/_logs/2021-08-04T07_46_39_555Z-debug.log
Note: Please concern the attached file and who have knowledge about this will be helpful to help me. Advanced Thanks!
You have dependency conflict which means that the dependency is incorrect and potentially broken. You could try to run the command with --force
, or --legacy-peer-deps
and see if that helps.
npm install @react-navigation/stack --force
or
npm install @react-navigation/stack --legacy-peer-deps
Sometimes removing the node_modules
and package-lock.json
file and run the command npm install @react-navigation/stack
or try npm cache clean --force
can work.