You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Expo+Firebase项目eas build构建失败求助

Expo React Native iOS EAS Build失败问题解决

问题背景

基于Expo的React Native项目,已集成Firebase数据库,使用eas build构建iOS版本提交App Store时持续失败,核心错误为main.jsbundle文件不存在,同时伴随ExpoModulesCore方法重复的警告。

错误日志

› Executing calculator » [CP] Check Pods Manifest.lock
› Executing calculator » Start Packager on http://localhost:8081
› Executing calculator » [Expo] Configure project
› Copying   ios/calculator/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling calculator » SplashScreen.storyboard
› Preparing calculator » Info.plist
› Compiling calculator » main.m
› Compiling calculator » calculator_vers.c
› Compiling calculator » AppDelegate.mm
› Linking   calculator » calculator
⚠️  ld: method '+moduleName' in category from /Users/expo/Library/Developer/Xcode/DerivedData/calculator-fxwyvqgdekbzjhfokipkknhjelmw/Build/Intermediates.noindex/ArchiveIntermediates/calculator/BuildProductsPath/Release-iphoneos/ExpoModulesCore/ExpoModulesCore.framework/ExpoModulesCore(ExpoBridgeModule-acfbb23c8b4083dfdb5ac41fb4f5357d.o) overrides method from class in /Users/expo/Library/Developer/Xcode/DerivedData/calculator-fxwyvqgdekbzjhfokipkknhjelmw/Build/Intermediates.noindex/ArchiveIntermediates/calculator/BuildProductsPath/Release-iphoneos/ExpoModulesCore/ExpoModulesCore.framework/ExpoModulesCore(ExpoBridgeModule-69a9b509dd25ae137b098ea769004bb2.o)
› Generating debug calculator » calculator.app.dSYM
› Executing calculator » Bundle React Native code and images
    Bundler cache is empty, rebuilding (this may take a minute)

❌  error: File /Users/expo/Library/Developer/Xcode/DerivedData/calculator-fxwyvqgdekbzjhfokipkknhjelmw/Build/Intermediates.noindex/ArchiveIntermediates/calculator/BuildProductsPath/Release-iphoneos/calculator.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues

▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸   PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/calculator-fxwyvqgdekbzjhfokipkknhjelmw/Build/Intermediates.noindex/ArchiveIntermediates/calculator/IntermediateBuildFilesPath/calculator.build/Release-iphoneos/calculator.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'calculator' from project 'calculator')
▸ (1 failure)
2024-01-22 09:31:13.362 xcodebuild[2052:8042] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
** ARCHIVE FAILED **
The following build commands failed:
    PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/calculator-fxwyvqgdekbzjhfokipkknhjelmw/Build/Intermediates.noindex/ArchiveIntermediates/calculator/IntermediateBuildFilesPath/calculator.build/Release-iphoneos/calculator.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'calculator' from project 'calculator')
(1 failure)
Exit status: 65
+-------------+-------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.213.0                 |
| sdk         | iPhoneOS16.4.sdk        |
+-------------+-------------------------+
Looks like fastlane ran into a build/archive error with your project
It's hard to tell what's causing the error, so we wrote some guides on how
to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
Before submitting an issue on GitHub, please follow the guide above and make
sure your project is set up correctly.
fastlane uses `xcodebuild` commands to generate your binary, you can see the
the full commands printed out in yellow in the above log.
Make sure to inspect the output above, as usually you'll find more error information there
[!] Error building the application - see the log above
Error: The "Run fastlane" step failed with an unknown error. Refer to "Xcode Logs" below for additional, more detailed logs.

项目app.json配置

{
  "expo": {
    "name": "calculator",
    "slug": "calculator",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/Vector.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/Vector.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "hidden"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      }
    },
    "web": {
      "favicon": "./assets/Vector.png"
    },
    "extra": {
      "eas": {
        "projectId": "hidden"
      },
      "firebase": {
        "apiKey": "hidden",
        "authDomain": "hidden",
        "projectId": "hidden",
        "storageBucket": "hidden",
        "messagingSenderId": "hidden",
        "appId": "hidden",
        "measurementId": "hidden"
      }
    },
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "buildToolsVersion": "31.0.0"
          },
          "ios": {
            "deploymentTarget": "13.4",
            "useFrameworks": "static"
          }
        }
      ]
    ]
  }
}

解决步骤

  • 清理缓存与依赖

    1. 执行npx expo start --clear清除Expo缓存
    2. 删除node_modules目录,重新执行npm install(或yarn install)安装依赖
    3. 若项目为bare workflow,进入ios目录执行pod deintegrate && pod install后返回根目录
  • 调整构建配置
    修改app.json中expo-build-properties的iOS配置:

    • 尝试移除useFrameworks: "static",或改为"dynamic"(静态框架易引发模块冲突)
    • 确认assetBundlePatterns为["**/*"],确保所有资源被正确打包
  • 预先生成JS Bundle

    1. 本地执行npx expo export -p ios生成main.jsbundle
    2. 将生成的文件提交到代码仓库后,重新触发eas build
    3. 或在eas.json的iOS构建配置中添加"prebuildCommand": "npx expo export -p ios",让构建流程自动预打包
  • 修复依赖冲突

    1. 执行npm dedupe(或yarn dedupe)合并重复的依赖包,解决ExpoModulesCore方法重复的警告
    2. 检查package.json中Expo SDK、react-native、expo-modules-core等依赖版本是否匹配,建议升级到稳定的SDK版本

内容的提问来源于stack exchange,提问作者BEN_Stacey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 11:58:13