react-native: 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.

I tried to add new schemas to ios project. I added Staging-Debug copied from default Debug schema. When application is loading I catch the next error:

2019-10-24 15:43:05.427 [error][tid:com.facebook.react.JavaScript] Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
2019-10-24 15:43:05.430 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
2019-10-24 15:43:05.433396+0300 HelloGuest[3076:1701296] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.', reason: 'Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the na..., stack:
getEnforcing@4947:28
<unknown>@41941:50
loadModuleImplementation@271:14
<unknown>@41900:40
loadModuleImplementation@271:14
<unknown>@36481:18
loadModuleImplementation@271:14
<unknown>@29159:16
loadModuleImplementation@271:14
guardedLoadModule@163:47
global code@375133:4

React Native version:

System: OS: macOS 10.15 CPU: (4) x64 Intel® Core™ i7-5557U CPU @ 3.10GHz Memory: 110.47 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.3 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 Android SDK: API Levels: 23, 24, 26, 27, 28 Build Tools: 23.0.1, 27.0.3, 28.0.2, 28.0.3 System Images: android-24 | Google Play Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 11.0/11A420a - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.2 => 0.61.2 npmGlobalPackages: react-native-cli: 2.0.1 react-native-create-library: 3.1.2 react-native-git-upgrade: 0.2.7

Why can it happen?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 21
  • Comments: 46 (4 by maintainers)

Most upvoted comments

I was able to solve this in my Podfile

target 'MyApp' do
  project 'MyApp',
  'Staging-Debug' => :debug,
  'Staging-Release' => :release,
  ...

This ensures that your build configuration is marked as “debug” or “release” in the underlying Pod xcode projects (including react-native).

Reference: https://guides.cocoapods.org/syntax/podfile.html#project

@mykhailo-melnyk

  1. No Problem:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'MyApp' do
  project 'MyApp', 
  'Staging-Debug' => :debug,
  'Staging-Release' => :release,

  # Pods for HBAPP
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  use_native_modules!

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
       phase.shell_script = "cd ../../"\
        " && RNC_ROOT=./node_modules/react-native-config/"\
        " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
        " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"
 
       target.build_phases << phase
       target.build_phases.move(phase,0)
    end
  end
end
  1. I was previously using react-native-scheme-manager to do this in older version of RN. What this did was go through every xcodeproj file that existed in node_modules and wrote all my projects build configurations in them (at least that is my rough understanding). What the Podfile does is quite similar, except it does no rewriting. It basically says take the build configuration “Staging-Debug” and handle it as if it were the build configuration “debug” in all the Pod dependencies. That is also only my rough understanding of how it works.

  2. Yes. I would recommend a complete reinstall of everything:

> rm -rf node_modules
> yarn
> cd ios
> pod install

Another caveat, if you, like me, are coming from using 'react-native-scheme-manager", uninstall this completely using the instructions from https://github.com/thekevinbrown/react-native-schemes-manager#uninstalling In my case this was no longer necessary to have and only caused more problems migrating from RN 59 -> 61

I was able to solve this problem, move custom configurations in Podfile above target section. image

Getting this too, any ideas?

Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.

It’s fine for me on dev with Debug config but using our Staging configuration, app builds but then crashes and I see this 😦

In Build Phases, there is a phase called Bundle React Native Code and Images. That runs a script that creates the bundle for release builds. It fails for me most of the time. I commented it out and created the bundle manually by running this:

react-native bundle --entry-file index.js --dev false --reset-cache --bundle-output main.jsbundle

After that, drag the bundle into the Xcode project and try running again in release mode.

Unfortunately we are still receiving this error. We are building a fresh app on 0.61.4.

Error:

[fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
libc++abi.dylib: terminating with uncaught exception of type NSException

Podfile:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'MyApp' do
  # Custom Configs
  project 'MyApp',
  'Debug (Staging)' => :debug,
  'Debug (Production)' => :debug,
  'Release (Staging)' => :release,
  'Release (Production)' => :release
  
  # Pods for MyApp
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  
  # Firebase
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'RNFBDatabase', :path => '../node_modules/@react-native-firebase/database'
  pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'
  
  pod 'ReactNativeNavigation', :podspec => '../node_modules/react-native-navigation/ReactNativeNavigation.podspec'
  
  pod 'react-native-intercom', :path => '../node_modules/react-native-intercom'
  
  ## PERMISSIONS
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

  use_native_modules!
end

We have done several full removals and reinstalls of the pods including the lockfile. Not sure where to go from here, any help would be greatly appreciated.

I’m not using custom configurations, we only have Debug|Release schemas.

I’ve been trying with 0.62.2, and 0.63.2, but still having instant crash when run on release mode or when testers got new build from testflight.

2020-08-04 10:14:38.514908-0500 RNCliDagM8[67965:1042593] [] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2020-08-04 10:14:38.515 [error][tid:com.facebook.react.JavaScript] Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
2020-08-04 10:14:38.516991-0500 RNCliDagM8[67965:1042593] [] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2020-08-04 10:14:38.518256-0500 RNCliDagM8[67965:1042584] [] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2020-08-04 10:14:38.518556-0500 RNCliDagM8[67965:1042584] TCP Conn 0x600003a84e40 Failed : error 0:61 [61]
2020-08-04 10:14:38.519 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
2020-08-04 10:14:38.552387-0500 RNCliDagM8[67965:1042593] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.', reason: 'Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the na..., stack:```

Removing the --development flag from my codepush release build process resolved this error for me.

@takameyer Yes, this is how I created the additional configurations. I duplicated Debug and Release to create the new Staging and Production debug and release configurations.

UPDATE: I have actually removed all other build configurations and reverted back to the default Debug and Release configs and we are still receiving the error: 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary. after any codepush update restart.

Our issue is related to this issue: https://github.com/microsoft/react-native-code-push/issues/1704

UPDATE: Downgrading react-native to 0.60.5 fixed our issues.

Well, I feel pretty dumb, but in my case it ended up being that I was using DevSettings in my index.js file, so I needed to make sure that code only ran in dev, like so:

if (Config.ENV == 'development') {
  ...
}

I’ve been experiencing the same issue since I updated to Xcode 12.

Here is my react-native info output:

System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 4.21 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
    Yarn: Not Found
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.3
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 12.0/12A7209 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_251 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Here is what happens when I try to run the scheme in Release mode.

libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.', reason: 'Unhandled JS Exception: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the na..., stack:
invariant@4555:25
getEnforcing@4826:27
<unknown>@35255:49
loadModuleImplementation@271:13
<unknown>@35165:61
loadModuleImplementation@271:13
<unknown>@34910:31
loadModuleImplementation@271:13
<unknown>@35943:35
loadModuleImplementation@271:13
<unknown>@27866:15
loadModuleImplementation@271:13
guardedLoadModule@163:46
global code@180966:3
'
terminating with uncaught exception of type NSException
(lldb) 

Important note is that I am able to run my build in Debug mode.

Update: I simply downloaded Xcode 11.6 and my release build continued to work.

I had this problem, but turns out I wasn’t using the correct build configuration name.

If you’re working on a brownfield app like me, here’s where you can see the exact build configuration names in the scheme editor:

Screen Shot 2019-11-20 at 12 01 06 PM

Make sure they match up exactly in your podfile:

Screen Shot 2019-11-20 at 12 03 01 PM

After getting those to match, everything started working on RN 0.61.4.

Workaround for me

  1. renamed back my “DEMO Debug” config to “Debug”
  2. changed my schemes accordingly
  3. also fixed “React(missing)” in Build part of schemes.

Снимок экрана 2019-10-29 в 12 31 00 (Delete the React (missing), click on the + on the bottom left, add React (from pods section). Finally, check all the checkboxes and place React at the top of the list.)

Now debug build working as expected, but i cant use different configs for different schemas, only 1 “Debug”.

This is just a workaround that might provide some relief. This worked on RN v0.62 but not RN v0.64

Do this only when building for none dev

Find this file node_modules/react-native/Libraries/Utilities/DevSettings.js

comment out this line or delete this line import NativeDevSettings from '../NativeModules/specs/NativeDevSettings';

comment out or delete this class:

class DevSettings extends NativeEventEmitter implements IDevSettings {
  _menuItems: Map<string, () => mixed>;

  constructor() {
    super(NativeDevSettings);

    this._menuItems = new Map();
  }

  addMenuItem(title: string, handler: () => mixed) {
    // Make sure items are not added multiple times. This can
    // happen when hot reloading the module that registers the
    // menu items. The title is used as the id which means we
    // don't support multiple items with the same name.
    const oldHandler = this._menuItems.get(title);
    if (oldHandler != null) {
      this.removeListener('didPressMenuItem', oldHandler);
    } else {
      NativeDevSettings.addMenuItem(title);
    }

    this._menuItems.set(title, handler);
    this.addListener('didPressMenuItem', event => {
      if (event.title === title) {
        handler();
      }
    });
  }

  reload(reason?: string) {
    if (typeof NativeDevSettings.reloadWithReason === 'function') {
      NativeDevSettings.reloadWithReason(reason ?? 'Uncategorized from JS');
    } else {
      NativeDevSettings.reload();
    }
  }

  onFastRefresh() {
    if (typeof NativeDevSettings.onFastRefresh === 'function') {
      NativeDevSettings.onFastRefresh();
    }
  }

  // TODO: Add other dev setting methods exposed by the native module.
}

modify this line

module.exports = ((__DEV__
  ? new DevSettings()
  : new NoopDevSettings()): IDevSettings);

To

module.exports = (new NoopDevSettings(): IDevSettings);

@takameyer thanks a lot! it really helped in my case ( I also removed using react-native-scheme-manager)

Hello, this error took me a lot of time as well 😦 so let me share the my solution, the problem is with the node_modules/react-native/scripts/react-native-xcode.sh for some reason is passing --dev true even in the release configurations. So i did a patched copy of the react-native-xcode.sh and copy it in the postintall script"

"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \
  $CONFIG_ARG \
  --entry-file "$ENTRY_FILE" \
  --platform ios \
  --dev false \. // pass as false dev
  --reset-cache \
  --bundle-output "$BUNDLE_FILE" \
  --assets-dest "$DEST" \
  $EXTRA_PACKAGER_ARGS

@takameyer Thank you for your solution, this works perfectly for my version of the issue!

For anyone with a similar issue to mine, this might be helpful: I’ve been on this issue way too long updating from 0.59 -> 0.61.4 and switching from manually linked packages to using cocoapods.

In my case the issue already presented it before this with ‘No bundle url present’ because preprocessing-variable RCT_DEV was automatically set to 0. Only after finding a workaround for that issue (setting the jsBundleLocation in AppDelegate.m to a hardcoded value in case it was nil) I got the issue seen above.

We are using react-native-schemes-manager which previously solved this issue automagically.

Same here!

I have the same issue with you 😦