-
Notifications
You must be signed in to change notification settings - Fork 935
Description
Description
The npx react-native run-ios command fails when running against the rn-tester app because it cannot locate the Gemfile. In rn-tester, the Gemfile is in the same directory as the Podfile, but the CLI assumes the standard project structure where the Gemfile is one level above the ios folder.
Steps to Reproduce
gh repo clone facebook/react-native- Run
yarnto install dependencies cd packages/rn-tester- Run
yarn clean-ios - Run
yarn prepare-ios - Run
npx react-native run-ios --scheme RNTester --simulator "iPhone 16"
Expected Behavior
The command should successfully locate the Gemfile and install CocoaPods dependencies.
Actual Behavior
The command fails with:
✖ Installing CocoaPods...
Environment
React Native: (main branch)
OS: macOS
Node: (your version)
Root Cause
Modern React Native apps follow this structure:
ios/Podfile
Gemfile
However, rn-tester has:
packages/rn-tester/Podfile
packages/rn-tester/Gemfile
The CLI's Gemfile lookup logic doesn't account for projects where the Gemfile is colocated with the Podfile.
Workaround
Changing the Gemfile check in node_modules/@react-native-community/cli-config-apple/build/tools/installPods.js works locally:
- if (_fs().default.existsSync('../Gemfile') && !(options === null || options === void 0 ? void 0 : options.skipBundleInstall)) {
+ if (_fs().default.existsSync('./Gemfile') && !(options === null || options === void 0 ? void 0 : options.skipBundleInstall)) {Proposed Solution
Add an environment variable (e.g., RCT_GEMFILE_PATH) to allow overriding the Gemfile path. This would enable non-standard project structures like rn-tester to specify their Gemfile location without requiring changes to the project layout.
Alternatively, the CLI could check for a Gemfile in the same directory as the Podfile before falling back to the parent directory.