11

I was trying to add $ npm install react-native-touchable-bounce --save but it was giving an error the same as the following. then I deleted all node_modules still getting this error. npm install gives the following error.

PS I:\Code\singal res\code\singalRes> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined      
npm ERR! Found: react-native-svg@12.1.0
npm ERR! node_modules/react-native-svg
npm ERR!   react-native-svg@"^12.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-svg@"^9.13.6" from @ui-kitten/components@5.0.0
npm ERR! node_modules/@ui-kitten/components
npm ERR!   @ui-kitten/components@"^5.0.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\softb\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\softb\AppData\Local\npm-cache\_logs\2021-02-14T03_13_39_660Z-debug.log
sanket kheni
  • 1,482
  • 2
  • 12
  • 29

3 Answers3

11

for me adding the --force flag fixed the issue

npm i --force

katinas
  • 432
  • 6
  • 11
5

maybe it's because of the lib version mismatch, you can delete the package-lock.json and node_modules, then try npm install again.

vuongvu
  • 811
  • 6
  • 15
1

Temporary Solution

This issue can be fixed by running npm i your-dependency --force .

This issue occurs because npm can't automatically fix the dependencies mismatch.

Cause

If you want to know why this happen go here.

Permanent Solution

If you never heard about yarn, its new package manager came after npm. it is very similar to npm and it has many benefits. one of them is it can automatically fix this issue.

How to install yarn.

By the way, there are many new emerging package managers too pnpm and others.

sanket kheni
  • 1,482
  • 2
  • 12
  • 29