Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevMenu'
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
| :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. |
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
| :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. |
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
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.
https://github.com/getsentry/sentry-react-native/issues/4201#issuecomment-2442369664
check if you are using reactroton and disable in case of release build
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 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
@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
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.
This issue was closed because it has been stalled for 7 days with no activity.