Sharcoux / slider

React-Native and React-Native-Web compatible slider
ISC License
156 stars 31 forks source link

Issue with npm install #96

Closed Kent27 closed 4 months ago

Kent27 commented 5 months ago

Hi I'm trying to npm install and got this error

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: rn9@0.0.1 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@"18.2.0" from the root project npm ERR! peer react@">=16.13.1" from @react-native-assets/slider@7.1.2 npm ERR! node_modules/@react-native-assets/slider npm ERR! @react-native-assets/slider@"7.1.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^18.3.1" from react-dom@18.3.1 npm ERR! node_modules/react-dom npm ERR! peer react-dom@">=16.13.1" from @react-native-assets/slider@7.1.2 npm ERR! node_modules/@react-native-assets/slider npm ERR! @react-native-assets/slider@"7.1.2" 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 /Users/kent/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/kent/.npm/_logs/2024-04-29T09_29_12_485Z-debug-0.log

I'm guessing it's related to #74 Thanks

Sharcoux commented 5 months ago

The log says that you installed react 18.2.0 along with react-dom: 18.3.1

Those 2 versions are not compatible because react-dom 18.3.1 requires react 18.3.1.

Just fix the dependencies of your project.

Nicolis1 commented 4 months ago

@Sharcoux, dependencies aren't my strong suit, so I could be wrong here, but I don't think it's as simple as that. Updating to react@18.3.1 breaks the dependency with react-native@latest Launching with npx create-expo-app as of today gives react@18.2.0 and react-native@0.73.6 I think the react-dom dependency here uses an incompatible version of react to the latest react-native release.

It's unclear to me how to resolve these deps.

Nicolis1 commented 4 months ago

@Kent27 I think I have a fix. Replacing react:^18.2.0 with react:18.2.0 and also installing react-dom@18.2.0 allows you to install this package. react-native@latest is only compatible with version 18.2.0 of react.

If you include the ^ react-dom@18.3.1 will be installed with this package, which is incompatible with react@18.2.0 You can't just upgrade react to 18.3.1 because that would break the react-native dependency.

my package.json looks like this:

 "dependencies": {
  "@react-native-assets/slider": "^7.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.73.6",
...
}
Sharcoux commented 4 months ago

I'm happy you solved your problem, but this is totally unrelated to this package.