react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevMenu'

Open alan-dev-hk opened this issue 1 year ago • 5 comments

Description

Hi, Guys.

Im stuck in this error for a while. It only happens in release mode. I dont know if it is a react native bug or not. Can any one help me please?

The error:

Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevMenu' when app will run on any device.

Steps to reproduce

1 - Change schema to Release 2 - Run

React Native Version

0.74.2

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.2.1
  CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
  Memory: 77.69 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.0
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.4
    path: /usr/local/bin/yarn
  npm:
    version: 6.14.18
    path: ~/DevFontes/SarApp/node_modules/.bin/npm
  Watchman:
    version: 2024.08.26.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.2 AI-212.5712.43.2112.8512546
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /Users/alanmachado/.jenv/shims/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.6
    wanted: 0.74.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.76.0 is now available (your project is running on v0.74.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.76.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.6
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevMenu' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["UIManager","PlatformConstants","DeviceInfo","SourceCode","BlobModule"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","HeadlessJsTaskSupport","DevMenu"]}, js engine: hermes

Reproducer

personal code

Screenshots and Videos

No response

alan-dev-hk avatar Oct 24 '24 20:10 alan-dev-hk

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.74.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Oct 24 '24 20:10 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

react-native-bot avatar Oct 24 '24 20:10 react-native-bot

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot avatar Oct 24 '24 20:10 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Oct 24 '24 20:10 react-native-bot

Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevMenu' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. Modules loaded: {"NativeModules":["UIManager","PlatformConstants","DeviceInfo","SourceCode","BlobModule"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","HeadlessJsTaskSupport","DevMenu"]}, js engine: hermes

The error is self explanatory @alan-dev-hk You're trying to load a module that is not loaded: DevMenu.

As this is one of the core components, I suspect there is something wrong in your app setup.

Without a reproducer we can't help further.

cortinico avatar Oct 24 '24 22:10 cortinico

https://github.com/getsentry/sentry-react-native/issues/4201#issuecomment-2442369664

mgltopdk avatar Oct 28 '24 18:10 mgltopdk

check if you are using reactroton and disable in case of release build

veris-kamaraj avatar Nov 05 '24 12:11 veris-kamaraj

Guys, the problem it was the reactotron. I made this path wich resolve the issue:

`--- a/node_modules/reactotron-react-native/src/plugins/devTools.ts +++ b/node_modules/reactotron-react-native/src/plugins/devTools.ts @@ -1,8 +1,8 @@ import { Platform } from "react-native" import type { ReactotronCore, Plugin } from "reactotron-core-client"

-let DevMenu = { show: () => {}, reload: () => {} } -if (Platform.OS === "ios") { +let DevMenu = { show: () => { }, reload: () => { } } +if ((Platform.OS === "ios") && DEV) { DevMenu = require("react-native/Libraries/NativeModules/specs/NativeDevMenu") } ` The problem is about Reactotron wich inject devMenu dependency even in release mode.

Thanks

alan-dev-hk avatar Nov 05 '24 12:11 alan-dev-hk

@alan-dev-hk any workaround for this? I would like to use reactotron sometimes for Release locally when some edge case weird bugs that only happen on Release happen

johhansantana avatar Nov 17 '24 03:11 johhansantana

@alan-dev-hk any workaround for this? I would like to use reactotron sometimes for Release locally when some edge case weird bugs that only happen on Release happen

Hi, If Im correctly, reactotron does not work in release mode. You can see the XCode Terminal which show all errors and warning when you run the app

alan-dev-hk avatar Nov 18 '24 11:11 alan-dev-hk

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

react-native-bot avatar May 18 '25 05:05 react-native-bot

This issue was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar May 25 '25 05:05 react-native-bot