I’m having a problem building my project after recently upgrading to the new Expo version. When I run the :
eas build --platform iOS
I get an error in Fastlane. Here is the content of the error below.
On the previous version of Expo, everything worked perfectly.
Project Setup:
• Expo SDK: 51.0.20
• React Native: 0.74.3
• Expo CLI
• EAS CLI
Error Message:
(ios/Pods/Headers/Public/ReactCommon/ReactCommon.modulemap:1:8)
> 1 | module ReactCommon {
| ^ redefinition of module 'ReactCommon'
2 | umbrella header "ReactCommon-umbrella.h"
3 | exclude header "React-RuntimeApple-umbrella.h"
4 |
› Compiling react-native Pods/React-RCTAppDelegate » RCTRootViewFactory.mm
⚠️ Script has ambiguous dependencies causing it to run on every build.
To fix, go to: Xcode » verseapp/verseapp » Build Phases » '[CP-User] [RNFB] Core Configuration'
Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ CompileC /Users/expo/Library/Developer/Xcode/DerivedData/verseapp-frukfgckrzhanffhpufsuiextprw/Build/Intermediates.noindex/ArchiveIntermediates/verseapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-RCTAppDelegate.build/Objects-normal/arm64/React-RCTAppDelegate-dummy.o /Users/expo/workingdir/build/ios/Pods/Target Support Files/React-RCTAppDelegate/React-RCTAppDelegate-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-RCTAppDelegate' from project 'Pods')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
CompileC /Users/expo/Library/Developer/Xcode/DerivedData/verseapp-frukfgckrzhanffhpufsuiextprw/Build/Intermediates.noindex/ArchiveIntermediates/verseapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-RCTAppDelegate.build/Objects-normal/arm64/React-RCTAppDelegate-dummy.o /Users/expo/workingdir/build/ios/Pods/Target Support Files/React-RCTAppDelegate/React-RCTAppDelegate-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-RCTAppDelegate' from project 'Pods')
(1 failure)
eas.json
{
"cli": {
"version": ">= 7.1.3",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"channel": "development"
},
"preview": {
"distribution": "internal",
"channel": "preview"
},
"production": {
"channel": "production",
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}
app.json
{
"expo": {
"name": "verseapp",
"slug": "verseapp",
"version": "1.4.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"notification": {
"icon": "./assets/notification-icon.png",
"color": "#D39E54"
},
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#D39E54"
},
"assetBundlePatterns": ["**/*"],
"ios": {
"bitcode": false,
"infoPlist": {
"NSCameraUsageDescription": "This app uses the camera to take photos and videos."
},
"supportsTablet": true,
"icon": "./assets/icon.png",
"bundleIdentifier": "com.verseapp.verseapp"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#D39E54",
"googleServicesFile": "./google-services.json"
},
"package": "com.verseapp.verseapp"
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
"expo-font",
"./withModularHeadersPlugin",
[
"expo-notifications",
{
"icon": "./assets/notification-icon.png",
"color": "#D39E54"
}
],
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 34,
"targetSdkVersion": 34,
"buildToolsVersion": "34.0.0"
},
"ios": {
"deploymentTarget": "13.4"
}
}
]
],
"extra": {
"eas": {
"projectId": "a7525463-2f90-4252-8d74-e078......."
}
},
"runtimeVersion": {
"policy": "appVersion"
},
"updates": {
"url": "https://u.expo.dev/a7525463-2f90-4252-8d74-e078b....."
}
}
}
Custom Plugin:
withModularHeadersPlugin.js
const { createRunOncePlugin, withDangerousMod } = require("@expo/config-plugins");
const fs = require("fs");
const path = require("path");
const withModularHeaders = (config) => {
return withDangerousMod(config, [
"ios",
async (config) => {
// Path to the iOS directory
const iosDir = config.modRequest.platformProjectRoot;
const podfilePath = path.join(iosDir, "Podfile");
let podfileContents = fs.readFileSync(podfilePath, "utf8");
// Ensure use_modular_headers! is at the top
if (!podfileContents.includes("use_modular_headers!")) {
podfileContents = `use_modular_headers!n${podfileContents}`;
}
// Modify FirebaseCoreInternal
podfileContents = podfileContents.replace(
"pod 'FirebaseCoreInternal'",
"pod 'FirebaseCoreInternal', :modular_headers => true"
);
// Modify ReactCommon
podfileContents = podfileContents.replace(
/pod 'ReactCommon',s*:[^,]+, :modular_headers => true/,
`pod 'ReactCommon', :path => "#{node_modules_path}/ReactCommon", :modular_headers => false`
);
// Write the modified contents back to the Podfile
fs.writeFileSync(podfilePath, podfileContents);
return config;
},
]);
};
module.exports = createRunOncePlugin(
withModularHeaders,
"withModularHeaders",
"1.0.0"
);
I have tried the following approaches to resolve this issue:
1. Adding use_modular_headers! to the Podfile.
2. Setting :modular_headers => false for ReactCommon.
3. Using a custom Expo Config Plugin to modify the Podfile.
Despite these efforts, the error persists. Any guidance or suggestions to resolve this issue would be greatly appreciated. Thank you!