Originally published on PEAKIQ
Fix: "Multiple commands produce" error
Warning: This fix targets RNWifi specifically. Your case may differ —
verify against the original source if your target name or project structure is different.
When Xcode throws a "Multiple commands produce" error in a React Native project, it typically means two build targets are competing to output the same file. The most common culprit is RNWifi. This guide walks through both the Xcode-side fix and the Podfile patch needed to fully resolve it.
Part 1 — Xcode Configuration
Open your project's .xcworkspace file in Xcode, then follow these steps:
1. Navigate to the RNWifi library
In the Project Navigator (left sidebar), expand:
Libraries → RNWifi.xcodeproj
2. Open Build Settings
Click on RNWifi.xcodeproj, go to the Build Settings tab, and under Targets select the first target in the list.
3. Add the Header Search Path
Scroll to Search Paths → Header Search Paths and add:
${SRCROOT}/../../../ios/Pods/Headers
Set the path type to recursive.
Part 2 — Podfile Fix
Open your ios/Podfile and replace the post_install block with the following. This explicitly removes the duplicate targets (React and RNWifi) that trigger the Xcode conflict and enforces a consistent iOS deployment target across all remaining pods.
use_flipper!
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
# Remove conflicting targets — RNWifi causes the duplicate
targets_to_ignore = %w(React RNWifi)
if targets_to_ignore.include?(target.name)
target.remove_from_project
next
end
# Enforce minimum iOS deployment target for all other pods
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
Key lines explained:
| Line | Purpose |
|---|---|
targets_to_ignore |
Lists targets to strip from the Pods project |
remove_from_project |
Removes the target entirely before the build runs |
IPHONEOS_DEPLOYMENT_TARGET |
Silences deployment target warnings on remaining pods |
Part 3 — Final Steps
From your project root, re-install pods:
cd ios && pod install
Then in Xcode, clean and rebuild:
| Action | Shortcut |
|---|---|
| Clean build folder | ⌘ Shift K |
| Rebuild | ⌘ B |
The error should be gone after a clean rebuild.
Troubleshooting
Error persists after pod install?
Wipe the Pods cache entirely and reinstall:
rm -rf ios/Pods ios/Podfile.lock
cd ios && pod install
Different library causing the conflict?
Add it to the ignore list using the same pattern:
targets_to_ignore = %w(React RNWifi YourConflictingLib)
Top comments (0)