souvik-ghosh / react-native-create-thumbnail

iOS/Android thumbnail generator with support for both local and remote videos
MIT License
251 stars 105 forks source link

Any plans on supporting react 17 and react native 0.64.2? #45

Closed vemulanishanth closed 2 years ago

vemulanishanth commented 3 years ago

Work flow:

Create a new react-native application and try installing this package

Error Log:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: <NameOfProject>@<Version of package>
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.1" from react-native-create-thumbnail@1.4.1
npm ERR! node_modules/react-native-create-thumbnail
npm ERR!   react-native-create-thumbnail@"1.4.1" 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 <Path to .npm folder>/eresolve-report.txt for a full report.

Proposed Solution:

This is because the package.json looks for explicit dependency on react and react-native. Since they are peer dependencies and does not affect actual functionality

Replace

"peerDependencies": {
"react": "^16.8.1",
"react-native": ">=0.59.0-rc.0 <1.0.x"
}

with

"peerDependencies": {
"react": ">=16.8.1",
"react-native": ">=0.59.0-rc.0 <1.0.x"
}

and publish a new version of the package.

Note:

Though this is the solution I propose with great confidence, I'd advise and request the maintainer to check if this is the only change required for solving the issue.

anhquan291 commented 3 years ago

Hi, I'm facing the same issue. Any solutions yet? Thanks a lot

ghost commented 3 years ago

@anhquan291 As temporary solution go for npm install --legacy-peer-deps of you are using npm v7+ it will install npm packages as though like it is npm v4.x and v6.x But this is not a permanent solution.

anhquan291 commented 3 years ago

@anhquan291 As temporary solution go for npm install --legacy-peer-deps of you are using npm v7+ it will install npm packages as though like it is npm v4.x and v6.x But this is not a permanent solution.

thank you so much

jimji1005 commented 3 years ago

FYI npm7 will break a shit ton of library installs, do not use npm7.

ghost commented 3 years ago

FYI npm7 will break a shit ton of library installs, do not use npm7.

But, what can we do?! A new React-Native Application with npx react-native init ...., comes with react 17. The issues caused by npm7 can be overcome with legacy peer deps but the dependency on third-party packages that have configured their package dependencies without future-proofing is the main issue.

The only ways are,

  1. Future-proofing by using >= in dependencies. Or actively providing fixes when bugs/requests arise. - By Dev
  2. Create an issue in the repo and wait for a dev to fix it. - By Package Consumer
  3. Fork Repository and solve it yourself. Then create PR to the main repo while using the forked repo for your application until it is merged. - By Package Consumer

Both a Major Pro and Major con of React-Native is this dependency on third party packages.

souvik-ghosh commented 2 years ago

I've removed the peer dependencies in v1.5.0. closing this as of now.