nandorojo/moti

Cannot read properties of null (reading 'useRef')

Closed this issue ยท 9 comments

Not sure this is the correct place to ask, but I have some issues with using Moti when building both to simulator and to real device.

Specs:

  • MacBook Pro 2021 (M1 processor)
  • React: 17.0.2
  • React Native: 0.66.0
  • Moti: 0.17.1

The app crashes with an error saying:

  • "Cannot read properties of null (reading 'useRef')"
  • "Cannot read properties of null (reading 'useContext')"

image

It seems to be related to AnimatePresence. When looking into the code it seems like it's coming from:
node_modules/@motify/core/node_modules/react/cjs/react.development.js (Row: 1623)

Worth mentioning is that it work for me previously, but I did a clean install of the repo and since then this issue keeps occuring.

Tried what I could think of:

  • rm -rf node_modules/
  • pod deintegrate
  • npm i
  • pod install
  • Making sure that all metro bundlers are closed
  • Clean build folder
  • Turning of remote debugging
  • npm cache clear --force
  • npm start

can you show the whole error instead of a cropped screenshot? could you copy the stack trace from the console

a few questions. are you in a monorepo? do you have multiple versions of react installed?

try running yarn why react

Absolutely, here it is:
image
image

a few questions. are you in a monorepo? do you have multiple versions of react installed?

try running yarn why react

npm why react
react@18.0.0 peer
node_modules/@motify/core/node_modules/react
  peer react@">=16.8 || ^17.0.0" from framer-motion@3.10.6
  node_modules/@motify/core/node_modules/framer-motion
    framer-motion@"^3.9.1" from @motify/core@0.17.1
    node_modules/@motify/core
      @motify/core@"^0.17.1" from @motify/components@0.17.1
      node_modules/@motify/components
        @motify/components@"^0.17.1" from moti@0.17.1
        node_modules/moti
          moti@"^0.17.1" from the root project
      @motify/core@"^0.17.1" from moti@0.17.1
      node_modules/moti
        moti@"^0.17.1" from the root project
  peer react@"^18.0.0" from react-dom@18.0.0
  node_modules/@motify/core/node_modules/react-dom
    peer react-dom@">=16.8 || ^17.0.0" from framer-motion@3.10.6
    node_modules/@motify/core/node_modules/framer-motion
      framer-motion@"^3.9.1" from @motify/core@0.17.1
      node_modules/@motify/core
        @motify/core@"^0.17.1" from @motify/components@0.17.1
        node_modules/@motify/components
          @motify/components@"^0.17.1" from moti@0.17.1
          node_modules/moti
            moti@"^0.17.1" from the root project
        @motify/core@"^0.17.1" from moti@0.17.1
        node_modules/moti
          moti@"^0.17.1" from the root project

react@16.5.0 peer
node_modules/@ui-kitten/eva-icons/node_modules/react
  peer react@"16.5.0" from react-native-eva-icons@1.3.1
  node_modules/@ui-kitten/eva-icons/node_modules/react-native-eva-icons
    react-native-eva-icons@"^1.3.1" from @ui-kitten/eva-icons@5.1.2
    node_modules/@ui-kitten/eva-icons
      @ui-kitten/eva-icons@"^5.1.1" from the root project

react@17.0.2
node_modules/react
  react@"17.0.2" from the root project
  peer react@"*" from @papercups-io/chat-widget-native@1.0.5
  node_modules/@papercups-io/chat-widget-native
    @papercups-io/chat-widget-native@"^1.0.5" from the root project
  peer react@"16 || 17" from @react-native-community/cameraroll@4.1.2
  node_modules/@react-native-community/cameraroll
    @react-native-community/cameraroll@"^4.1.2" from the root project
  peer react@">=16.8.0" from @react-native-community/hooks@2.8.1
  node_modules/@react-native-community/hooks
    @react-native-community/hooks@"^2.6.0" from @fullstackcraft/react-native-keyboard-shift@1.1.5-alpha0
    node_modules/@fullstackcraft/react-native-keyboard-shift
      @fullstackcraft/react-native-keyboard-shift@"^1.1.5-alpha0" from the root project
  peer react@"*" from @react-native-firebase/app@14.7.0
  node_modules/@react-native-firebase/app
    @react-native-firebase/app@"^14.2.1" from the root project
    peer @react-native-firebase/app@"14.7.0" from @react-native-firebase/messaging@14.7.0
    node_modules/@react-native-firebase/messaging
      @react-native-firebase/messaging@"^14.2.1" from the root project
  peer react@"*" from @react-navigation/bottom-tabs@6.3.1
  node_modules/@react-navigation/bottom-tabs
    @react-navigation/bottom-tabs@"^6.0.9" from the root project
  peer react@"*" from @react-navigation/core@6.2.1
  node_modules/@react-navigation/core
    @react-navigation/core@"^6.2.1" from @react-navigation/native@6.0.10
    node_modules/@react-navigation/native
      @react-navigation/native@"^6.0.6" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/elements@1.3.3
      node_modules/@react-navigation/elements
        @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
        node_modules/@react-navigation/bottom-tabs
          @react-navigation/bottom-tabs@"^6.0.9" from the root project
        @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
        node_modules/@react-navigation/native-stack
          @react-navigation/native-stack@"^6.2.5" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
  peer react@"*" from @react-navigation/elements@1.3.3
  node_modules/@react-navigation/elements
    @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
    node_modules/@react-navigation/bottom-tabs
      @react-navigation/bottom-tabs@"^6.0.9" from the root project
    @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
    node_modules/@react-navigation/native-stack
      @react-navigation/native-stack@"^6.2.5" from the root project
  peer react@"*" from @react-navigation/native@6.0.10
  node_modules/@react-navigation/native
    @react-navigation/native@"^6.0.6" from the root project
    peer @react-navigation/native@"^6.0.0" from @react-navigation/bottom-tabs@6.3.1
    node_modules/@react-navigation/bottom-tabs
      @react-navigation/bottom-tabs@"^6.0.9" from the root project
    peer @react-navigation/native@"^6.0.0" from @react-navigation/elements@1.3.3
    node_modules/@react-navigation/elements
      @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
    peer @react-navigation/native@"^6.0.0" from @react-navigation/native-stack@6.6.1
    node_modules/@react-navigation/native-stack
      @react-navigation/native-stack@"^6.2.5" from the root project
  peer react@"*" from @react-navigation/native-stack@6.6.1
  node_modules/@react-navigation/native-stack
    @react-navigation/native-stack@"^6.2.5" from the root project
  peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context@0.4.1
  node_modules/mini-create-react-context
    mini-create-react-context@"^0.4.0" from react-router@5.2.1
    node_modules/react-router
      react-router@"5.2.1" from react-router-native@5.2.1
      node_modules/react-router-native
        react-router-native@"^5.2.1" from the root project
  peer react@"^17.0.0" from react-freeze@1.0.0
  node_modules/react-freeze
    react-freeze@"^1.0.0" from react-native-screens@3.13.1
    node_modules/react-native-screens
      react-native-screens@"^3.10.1" from the root project
      peer react-native-screens@">= 3.0.0" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      peer react-native-screens@">= 3.0.0" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
      react-native-screens@"^3.4.0" from react-native-reanimated@2.4.1
      node_modules/react-native-reanimated
        react-native-reanimated@"2.4.1" from the root project
        peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
        node_modules/react-native-redash
          react-native-redash@"^16.2.3" from the root project
  peer react@"17.0.2" from react-native@0.66.0
  node_modules/react-native
    react-native@"0.66.0" from the root project
    peer react-native@"*" from @notifee/react-native@3.0.4
    node_modules/@notifee/react-native
      @notifee/react-native@"^3.0.4" from the root project
    peer react-native@"*" from @papercups-io/chat-widget-native@1.0.5
    node_modules/@papercups-io/chat-widget-native
      @papercups-io/chat-widget-native@"^1.0.5" from the root project
    peer react-native@"^0.0.0-0 || 0.60 - 0.68 || 1000.0.0" from @react-native-async-storage/async-storage@1.17.3
    node_modules/@react-native-async-storage/async-storage
      @react-native-async-storage/async-storage@"^1.15.14" from the root project
    peer react-native@">=0.60" from @react-native-community/cameraroll@4.1.2
    node_modules/@react-native-community/cameraroll
      @react-native-community/cameraroll@"^4.1.2" from the root project
    peer react-native@"*" from @react-native-community/cli@6.4.0
    node_modules/@react-native-community/cli
      @react-native-community/cli@"^6.0.0" from react-native@0.66.0
    peer react-native@">=0.59" from @react-native-community/hooks@2.8.1
    node_modules/@react-native-community/hooks
      @react-native-community/hooks@"^2.6.0" from @fullstackcraft/react-native-keyboard-shift@1.1.5-alpha0
      node_modules/@fullstackcraft/react-native-keyboard-shift
        @fullstackcraft/react-native-keyboard-shift@"^1.1.5-alpha0" from the root project
    peer react-native@"*" from @react-native-firebase/app@14.7.0
    node_modules/@react-native-firebase/app
      @react-native-firebase/app@"^14.2.1" from the root project
      peer @react-native-firebase/app@"14.7.0" from @react-native-firebase/messaging@14.7.0
      node_modules/@react-native-firebase/messaging
        @react-native-firebase/messaging@"^14.2.1" from the root project
    peer react-native@"*" from @react-navigation/bottom-tabs@6.3.1
    node_modules/@react-navigation/bottom-tabs
      @react-navigation/bottom-tabs@"^6.0.9" from the root project
    peer react-native@"*" from @react-navigation/elements@1.3.3
    node_modules/@react-navigation/elements
      @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
    peer react-native@"*" from @react-navigation/native@6.0.10
    node_modules/@react-navigation/native
      @react-navigation/native@"^6.0.6" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/elements@1.3.3
      node_modules/@react-navigation/elements
        @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
        node_modules/@react-navigation/bottom-tabs
          @react-navigation/bottom-tabs@"^6.0.9" from the root project
        @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
        node_modules/@react-navigation/native-stack
          @react-navigation/native-stack@"^6.2.5" from the root project
      peer @react-navigation/native@"^6.0.0" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
    peer react-native@"*" from @react-navigation/native-stack@6.6.1
    node_modules/@react-navigation/native-stack
      @react-navigation/native-stack@"^6.2.5" from the root project
    peer react-native@">=0.64.0" from react-native-contacts@7.0.4
    node_modules/react-native-contacts
      react-native-contacts@"^7.0.3" from the root project
    peer react-native@">=0.50.0" from react-native-countdown-circle-timer@2.5.4
    node_modules/react-native-countdown-circle-timer
      react-native-countdown-circle-timer@"^2.5.4" from the root project
    peer react-native@"*" from react-native-device-info@8.7.0
    node_modules/react-native-device-info
      react-native-device-info@"^8.4.4" from the root project
    peer react-native@">=0.60.0" from react-native-fast-image@8.5.11
    node_modules/react-native-fast-image
      react-native-fast-image@"^8.5.11" from the root project
    peer react-native@"*" from react-native-gesture-handler@2.3.2
    node_modules/react-native-gesture-handler
      react-native-gesture-handler@"^2.2.0" from the root project
      peer react-native-gesture-handler@"*" from react-native-reanimated@2.4.1
      node_modules/react-native-reanimated
        react-native-reanimated@"2.4.1" from the root project
        peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
        node_modules/react-native-redash
          react-native-redash@"^16.2.3" from the root project
      peer react-native-gesture-handler@"*" from react-native-redash@16.2.3
      node_modules/react-native-redash
        react-native-redash@"^16.2.3" from the root project
    peer react-native@">= 0.59" from react-native-google-places-autocomplete@2.4.1
    node_modules/react-native-google-places-autocomplete
      react-native-google-places-autocomplete@"^2.4.1" from the root project
    peer react-native@"*" from react-native-image-picker@4.7.3
    node_modules/react-native-image-picker
      react-native-image-picker@"^4.6.1" from the root project
    peer react-native@">=v0.40.0" from react-native-image-resizer@1.4.5
    node_modules/react-native-image-resizer
      react-native-image-resizer@"^1.4.5" from the root project
    peer react-native@">=0.42.0" from react-native-iphone-x-helper@1.3.1
    node_modules/react-native-iphone-x-helper
      react-native-iphone-x-helper@"^1.0.3" from react-native-keyboard-aware-scroll-view@0.9.5
      node_modules/react-native-keyboard-aware-scroll-view
        react-native-keyboard-aware-scroll-view@"^0.9.5" from the root project
    peer react-native@">=0.48.4" from react-native-keyboard-aware-scroll-view@0.9.5
    node_modules/react-native-keyboard-aware-scroll-view
      react-native-keyboard-aware-scroll-view@"^0.9.5" from the root project
    peer react-native@">=0.55" from react-native-linear-gradient@2.5.6
    node_modules/react-native-linear-gradient
      react-native-linear-gradient@"^2.5.6" from the root project
    peer react-native@">=0.63.3" from react-native-permissions@3.3.1
    node_modules/react-native-permissions
      react-native-permissions@"^3.2.0" from the root project
    peer react-native@"*" from react-native-quick-base64@2.0.2
    node_modules/react-native-quick-base64
      react-native-quick-base64@"^2.0.2" from the root project
    peer react-native@"*" from react-native-reanimated@2.4.1
    node_modules/react-native-reanimated
      react-native-reanimated@"2.4.1" from the root project
      peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
      node_modules/react-native-redash
        react-native-redash@"^16.2.3" from the root project
    peer react-native@"*" from react-native-redash@16.2.3
    node_modules/react-native-redash
      react-native-redash@"^16.2.3" from the root project
    peer react-native@"*" from react-native-safe-area-context@3.4.1
    node_modules/react-native-safe-area-context
      react-native-safe-area-context@"^3.3.2" from the root project
      peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/elements@1.3.3
      node_modules/@react-navigation/elements
        @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
        node_modules/@react-navigation/bottom-tabs
          @react-navigation/bottom-tabs@"^6.0.9" from the root project
        @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
        node_modules/@react-navigation/native-stack
          @react-navigation/native-stack@"^6.2.5" from the root project
      peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
    peer react-native@"*" from react-native-screens@3.13.1
    node_modules/react-native-screens
      react-native-screens@"^3.10.1" from the root project
      peer react-native-screens@">= 3.0.0" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      peer react-native-screens@">= 3.0.0" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
      react-native-screens@"^3.4.0" from react-native-reanimated@2.4.1
      node_modules/react-native-reanimated
        react-native-reanimated@"2.4.1" from the root project
        peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
        node_modules/react-native-redash
          react-native-redash@"^16.2.3" from the root project
    peer react-native@">=0.50.0" from react-native-svg@12.3.0
    node_modules/react-native-svg
      react-native-svg@"^12.1.1" from the root project
      peer react-native-svg@"*" from @ui-kitten/components@5.1.2
      node_modules/@ui-kitten/components
        @ui-kitten/components@"^5.1.1" from the root project
        peer @ui-kitten/components@"5.1.2" from @ui-kitten/eva-icons@5.1.2
        node_modules/@ui-kitten/eva-icons
          @ui-kitten/eva-icons@"^5.1.1" from the root project
      peer react-native-svg@"*" from @ui-kitten/eva-icons@5.1.2
      node_modules/@ui-kitten/eva-icons
        @ui-kitten/eva-icons@"^5.1.1" from the root project
      peer react-native-svg@">=6.2.1" from react-native-countdown-circle-timer@2.5.4
      node_modules/react-native-countdown-circle-timer
        react-native-countdown-circle-timer@"^2.5.4" from the root project
    peer react-native@"*" from react-native-webview@11.14.4
    node_modules/react-native-webview
      react-native-webview@"11.14.4" from the root project
    peer react-native@">=0.44" from react-router-native@5.2.1
    node_modules/react-router-native
      react-router-native@"^5.2.1" from the root project
  peer react@">=16.8.0" from react-native-countdown-circle-timer@2.5.4
  node_modules/react-native-countdown-circle-timer
    react-native-countdown-circle-timer@"^2.5.4" from the root project
  peer react@"^16.8.6 || ^17.0.0" from react-native-fast-image@8.5.11
  node_modules/react-native-fast-image
    react-native-fast-image@"^8.5.11" from the root project
  peer react@"*" from react-native-gesture-handler@2.3.2
  node_modules/react-native-gesture-handler
    react-native-gesture-handler@"^2.2.0" from the root project
    peer react-native-gesture-handler@"*" from react-native-reanimated@2.4.1
    node_modules/react-native-reanimated
      react-native-reanimated@"2.4.1" from the root project
      peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
      node_modules/react-native-redash
        react-native-redash@"^16.2.3" from the root project
    peer react-native-gesture-handler@"*" from react-native-redash@16.2.3
    node_modules/react-native-redash
      react-native-redash@"^16.2.3" from the root project
  peer react@"*" from react-native-image-picker@4.7.3
  node_modules/react-native-image-picker
    react-native-image-picker@"^4.6.1" from the root project
  peer react@">=16.13.1" from react-native-permissions@3.3.1
  node_modules/react-native-permissions
    react-native-permissions@"^3.2.0" from the root project
  peer react@"*" from react-native-quick-base64@2.0.2
  node_modules/react-native-quick-base64
    react-native-quick-base64@"^2.0.2" from the root project
  peer react@"*" from react-native-reanimated@2.4.1
  node_modules/react-native-reanimated
    react-native-reanimated@"2.4.1" from the root project
    peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
    node_modules/react-native-redash
      react-native-redash@"^16.2.3" from the root project
  peer react@"*" from react-native-redash@16.2.3
  node_modules/react-native-redash
    react-native-redash@"^16.2.3" from the root project
  peer react@"*" from react-native-safe-area-context@3.4.1
  node_modules/react-native-safe-area-context
    react-native-safe-area-context@"^3.3.2" from the root project
    peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/bottom-tabs@6.3.1
    node_modules/@react-navigation/bottom-tabs
      @react-navigation/bottom-tabs@"^6.0.9" from the root project
    peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/elements@1.3.3
    node_modules/@react-navigation/elements
      @react-navigation/elements@"^1.3.3" from @react-navigation/bottom-tabs@6.3.1
      node_modules/@react-navigation/bottom-tabs
        @react-navigation/bottom-tabs@"^6.0.9" from the root project
      @react-navigation/elements@"^1.3.3" from @react-navigation/native-stack@6.6.1
      node_modules/@react-navigation/native-stack
        @react-navigation/native-stack@"^6.2.5" from the root project
    peer react-native-safe-area-context@">= 3.0.0" from @react-navigation/native-stack@6.6.1
    node_modules/@react-navigation/native-stack
      @react-navigation/native-stack@"^6.2.5" from the root project
  peer react@"*" from react-native-screens@3.13.1
  node_modules/react-native-screens
    react-native-screens@"^3.10.1" from the root project
    peer react-native-screens@">= 3.0.0" from @react-navigation/bottom-tabs@6.3.1
    node_modules/@react-navigation/bottom-tabs
      @react-navigation/bottom-tabs@"^6.0.9" from the root project
    peer react-native-screens@">= 3.0.0" from @react-navigation/native-stack@6.6.1
    node_modules/@react-navigation/native-stack
      @react-navigation/native-stack@"^6.2.5" from the root project
    react-native-screens@"^3.4.0" from react-native-reanimated@2.4.1
    node_modules/react-native-reanimated
      react-native-reanimated@"2.4.1" from the root project
      peer react-native-reanimated@">=2.0.0" from react-native-redash@16.2.3
      node_modules/react-native-redash
        react-native-redash@"^16.2.3" from the root project
  peer react@"*" from react-native-svg@12.3.0
  node_modules/react-native-svg
    react-native-svg@"^12.1.1" from the root project
    peer react-native-svg@"*" from @ui-kitten/components@5.1.2
    node_modules/@ui-kitten/components
      @ui-kitten/components@"^5.1.1" from the root project
      peer @ui-kitten/components@"5.1.2" from @ui-kitten/eva-icons@5.1.2
      node_modules/@ui-kitten/eva-icons
        @ui-kitten/eva-icons@"^5.1.1" from the root project
    peer react-native-svg@"*" from @ui-kitten/eva-icons@5.1.2
    node_modules/@ui-kitten/eva-icons
      @ui-kitten/eva-icons@"^5.1.1" from the root project
    peer react-native-svg@">=6.2.1" from react-native-countdown-circle-timer@2.5.4
    node_modules/react-native-countdown-circle-timer
      react-native-countdown-circle-timer@"^2.5.4" from the root project
  peer react@"*" from react-native-webview@11.14.4
  node_modules/react-native-webview
    react-native-webview@"11.14.4" from the root project
  peer react@">=15" from react-router@5.2.1
  node_modules/react-router
    react-router@"5.2.1" from react-router-native@5.2.1
    node_modules/react-router-native
      react-router-native@"^5.2.1" from the root project
  peer react@">=15" from react-router-native@5.2.1
  node_modules/react-router-native
    react-router-native@"^5.2.1" from the root project
  peer react@"^16.0.0 || ^17.0.0" from react-shallow-renderer@16.14.1
  node_modules/react-shallow-renderer
    react-shallow-renderer@"^16.13.1" from react-test-renderer@17.0.2
    node_modules/react-test-renderer
      dev react-test-renderer@"17.0.2" from the root project
  peer react@"17.0.2" from react-test-renderer@17.0.2
  node_modules/react-test-renderer
    dev react-test-renderer@"17.0.2" from the root project

@nandorojo It seems like it's a few different ones from differents packages.

But if I see it correctly it's only 17.0.2 that's installed purposely.

Yeah I see. So your version of npm automatically installs peer deps. if you use the npm legacy peer deps feature it should fix it. or, set a resolution of react to 17.0.2 inside or your package.json.

Plainly, you should only use one version. Using yarn would also solve this.

npm i --legacy-peer-deps

Or, in your root package.json, add a resolution:

{
  "resolutions": { "react": "17.0.2" }
}

If you do this, you need to use yarn (or install an npm tool to do it for you). Make sure you set 17.0.2 to whichever version you actually want to use.

Yeah I see. So your version of npm automatically installs peer deps. if you use the npm legacy peer deps feature it should fix it. or, set a resolution of react to 17.0.2 inside or your package.json.

Plainly, you should only use one version. Using yarn would also solve this.

I'll try with using Yarn instead!

But when you say set a resolution of react inside the package.json, do you mean specify the version explicitly or are there any other way of "set a resolution of react to 17.0.2"?

Managed to get it to work with:
npm i --legacy-peer-deps

Thanks a lot!

Keystone requires a higher version of Next.js, specifically version 13.3 or above. If you encounter an error, please make sure to use at least this version. To fix the issue, you can add the following code to your package.json file:

"resolutions": {
  "next": "~13.3.0"
}

By adding this code, you're specifying a resolution to use Next.js version 13.3.0 or a compatible version. This can help resolve the problem you're facing. Make sure to save the package.json file after making this change.