Pure dependency conflicts with react native when using npm audit fix

  Kiến thức lập trình

So I’m using react native to build a mobile application and I have started getting peer dependency issues. When you search for this everyone tells you to retry command with --force or --legacy-peer-deps, but no one ever tells you how to actually fix the peer dependency issue.

I found a posting that said to run the following:

npm audit fix

However when I do I get the same issue:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @react-native-community/[email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error   react@"18.3.1" from the root project
npm error   peer react@"*" from @gorhom/[email protected]
npm error   node_modules/@gorhom/bottom-sheet
npm error     @gorhom/bottom-sheet@"^4.6.1" from the root project
npm error   28 more (@gorhom/portal, @radix-ui/react-compose-refs, ...)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.8" from @react-native-community/[email protected]
npm error node_modules/@react-native-community/async-storage
npm error   @react-native-community/async-storage@"^1.12.1" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/react
npm error   peer react@"^16.8" from @react-native-community/[email protected]
npm error   node_modules/@react-native-community/async-storage
npm error     @react-native-community/async-storage@"^1.12.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/coder/.npm/_logs/2024-05-16T18_09_22_997Z-eresolve-report.txt

npm error A complete log of this run can be found in: /home/coder/.npm/_logs/2024-05-16T18_09_22_997Z-debug-0.log

Can anyone help?

I tried

npm audit fix

I thought it would fix the problem

New contributor

b n is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT