question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use-subscription could not resolve dependency for react 18

See original GitHub issue

Description

The latest react-native (v0.68.0) depends on use-subscription: ^1.0.0, but v1.6.0 of use-subscription was just released two days ago and it peer depends on react: ^18.0.0 whereas react-native 0.68.0 peer depends on react v17.0.2 which is also what is installed in the vanilla React Native project (npx react-native init). This results in this warning when running npm install:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: use-subscription@1.6.0
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"17.0.2" from the root project
npm WARN   3 more (react-native, react-test-renderer, react-shallow-renderer)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^18.0.0" from use-subscription@1.6.0
npm WARN node_modules/use-subscription
npm WARN   use-subscription@"^1.0.0" from react-native@0.68.0
npm WARN   node_modules/react-native

(the warning is also present when using yarn)

Version

0.68.0

Output of npx react-native info

System: OS: macOS 12.2.1 CPU: (16) x64 Intel® Core™ i9-9880H CPU @ 2.30GHz Memory: 2.97 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm Watchman: 2022.01.31.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /Users/be9276/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.0 => 0.68.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

npx react-native init VanillaRN cd VanillaRN rm -rf node_modules npm i

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:12
  • Comments:8

github_iconTop GitHub Comments

3reactions
hoIIercommented, Apr 1, 2022
[Container] 2022/04/01 19:05:30 Running command npm ci
--
43 | npm WARN ERESOLVE overriding peer dependency
44 | npm WARN While resolving: use-subscription@1.6.0
45 | npm WARN Found: react@17.0.2
46 | npm WARN node_modules/react
47 | npm WARN   peer react@"17.0.2" from react-native@0.68.0
48 | npm WARN   node_modules/react-native
49 | npm WARN     peer react-native@"*" from @react-native-community/cli@7.0.3
50 | npm WARN     node_modules/@react-native-community/cli
51 | npm WARN     1 more (react-native-get-random-values)
52 | npm WARN   1 more (react-shallow-renderer)
53 | npm WARN
54 | npm WARN Could not resolve dependency:
55 | npm WARN peer react@"^18.0.0" from use-subscription@1.6.0
56 | npm WARN node_modules/use-subscription
57 | npm WARN   use-subscription@"^1.0.0" from react-native@0.68.0
58 | npm WARN   node_modules/react-native
59 | npm WARN
60 | npm WARN Conflicting peer dependency: react@18.0.0
61 | npm WARN node_modules/react
62 | npm WARN   peer react@"^18.0.0" from use-subscription@1.6.0
63 | npm WARN   node_modules/use-subscription
64 | npm WARN     use-subscription@"^1.0.0" from react-native@0.68.0
65 | npm WARN     node_modules/react-native
66 | npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
67 | npm ERR!
68 | npm ERR! Missing: fsevents@1.2.13 from lock file
69 | npm ERR!

Any update @jenskuhrjorgensen?

2reactions
AsteriskZuocommented, Apr 10, 2022

Solutions to the above problems: rm -rf ./node_modules/@types/react-native/node_modules/

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Fix the upstream dependency conflict, react-share ...
First, utilize the advised command npm install --save --legacy-peer-deps react-share. then, in your app root directory create a .npmrc file.
Read more >
use-subscription | Yarn - Package Manager
New features in React 18 don't work without it. Both createRoot and hydrateRoot accept a new option called onRecoverableError in case you want...
Read more >
npm WARN peer react@"^18.0.0" from use-subscription@1.6.0
Could not resolve dependency : npm ERR! peer react@"17.0.1" from react-dom@17.0.1. Javascript By Weary Wren on Oct 13 2021. npm install --legacy-peer-deps.
Read more >
Hooks - Apollo GraphQL Docs
Apollo Client react hooks API reference. ... a React component tree. This component can be imported directly from the @apollo/client package. JavaScript.
Read more >
react-meteor-data - Packosphere
useSubscribe ; useFind; Concurrent Mode, Suspense, and Error Boundaries ... Like all React hooks, it can only be used in function components, not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found