diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index d6fca9ff5..8f5dc4007 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -192,7 +192,7 @@ class ReactNativeModules { * * @todo: `fastlane` has been reported to not work too. */ - def cliResolveScript = "console.log(require('@react-native-community/cli').bin);" + def cliResolveScript = "console.log(require('react-native/cli').bin);" String[] nodeCommand = ["node", "-e", cliResolveScript] def cliPath = this.getCommandOutput(nodeCommand) diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index ed56e7523..5617bb146 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -15,7 +15,8 @@ def use_native_modules!(config = nil) config = nil; end - cli_resolve_script = "console.log(require('@react-native-community/cli').bin);" + # Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects + cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip if (!config)