skip to Main Content

I am having an issue installing a react-native project. This is a project from about a year ago that I’m trying to update with latest React. However, I am having a dependency issue.

I think this is an issue with react-native-scalable-image. However, if I do a:

npm install --save react-native-scalable-image --legacy-peer-deps

it looks like it works, but then if I try to install something else such as:

npm install --save react-native-screens

I get the following:

MacBook-Pro-3:project johnny$ npm install --save react-native-screens
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@">=16" from @react-native-masked-view/[email protected]
npm ERR!   node_modules/@react-native-masked-view/masked-view
npm ERR!     @react-native-masked-view/masked-view@"^0.2.9" from the root project
npm ERR!   peer react@"*" from @react-navigation/[email protected]
npm ERR!   node_modules/@react-navigation/core
npm ERR!     @react-navigation/core@"^6.4.9" from @react-navigation/[email protected]
npm ERR!     node_modules/@react-navigation/native
npm ERR!       peer @react-navigation/native@"^6.0.0" from @react-navigation/[email protected]
npm ERR!       node_modules/@react-navigation/elements
npm ERR!         @react-navigation/elements@"^1.3.18" from @react-navigation/[email protected]
npm ERR!         node_modules/@react-navigation/stack
npm ERR!       2 more (@react-navigation/stack, the root project)
npm ERR!   16 more (@react-navigation/elements, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.3" from [email protected]
npm ERR! node_modules/react-native-scalable-image
npm ERR!   react-native-scalable-image@"^1.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.3" from [email protected]
npm ERR!   node_modules/react-native-scalable-image
npm ERR!     react-native-scalable-image@"^1.1.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! 
npm ERR! For a full report see:
npm ERR! /Users/johnny/.npm/_logs/2023-09-21T01_55_14_959Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/johnny/.npm/_logs/2023-09-21T01_55_14_959Z-debug-0.log

Is the problem with react-native-scalable-image, or is it with something else? What can I do to fix it?

2

Answers


  1. delete your node modules folder and try running reinstall (npm install or npx expo install or yarn or w/e your using) for your items

    if not try downgrading your react version to 16.8.3

    Login or Signup to reply.
  2. react-native-scalable-image wants an older version of react to be present. This narrow version lockdown might be too strict, so you could try to add this override to package.json:

    "overrides": {
      "react-native-scalable-image": {
        "react": "18.2.0"
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search