🚨 Production builds fail, while development works (main.jsbundle does not exist)

My Expo app is failing to build on production builds both locally and on EAS cloud, but they succeed on development builds. The error is saying that main.jsbundle does not exist. I am not sure how to inspect the bundled code to see why main.jsbundle is missing. If I open the folder path in the error message (inside of DerivedData) I do not see any JS files. This is a project that we have recently integrated with Expo (v49) and was previously not using Expo. This is the first attempt at a production build. :exploding_head:

I found a few similar issues via Google but nothing helped unfortunately. I verified that App.tsx is in the project root (not inside /src). My guess is that my production build is not correctly making the JS bundle for my app, either with incorrect file path or just no bundle at all. How can I confirm what is being created for the bundle? There are no errors related to building the bundle. :rotating_light:

I have checked the Github issues for Expo, React Native, and Fastlane. There are a lot of people with similar issues (“main.jsbundle missing”) but nobody has a clear, actionable resolution to the problem. :female_detective:

Appreciate your help! :pray:

Error message:

› Executing MyApp » Bundle React Native code and images

    Bundler cache is empty, rebuilding (this may take a minute)

❌  error: File /Users/expo/Library/Developer/Xcode/DerivedData/MyApp-gyhfhucxsskziffgncaxtzasbcid/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.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


▸ The following build commands failed:

▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/MyApp-gyhfhucxsskziffgncaxtzasbcid/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MyApp' from project 'MyApp')

▸ (1 failure)

2023-09-12 10:39:47.278 xcodebuild[5017:15258] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)


The following build commands failed:

	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/MyApp-gyhfhucxsskziffgncaxtzasbcid/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MyApp' from project 'MyApp')

(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.

Version Info

eas-cli/5.2.0 darwin-x64 node-v20.5.1

Some info from package.json:

"main": "node_modules/expo/AppEntry.js",
"expo": "~49.0.7",
"react": "18.2.0",
"react-native": "0.72.4",

npx react-native info

% npx react-native info
info Fetching system and libraries information...
  OS: macOS 13.5.2
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 2.04 GB / 16.00 GB
    version: "5.9"
    path: /bin/zsh
    version: 20.5.1
    path: ~/.nvm/versions/node/v20.5.1/bin/node
    version: 1.22.19
    path: ~/.nvm/versions/node/v20.5.1/bin/yarn
    version: 9.8.0
    path: ~/.nvm/versions/node/v20.5.1/bin/npm
  Watchman: Not Found
    version: 1.12.1
    path: /usr/local/bin/pod
  iOS SDK:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
  Java: Not Found
    version: 2.6.10
    path: /usr/bin/ruby
  "@react-native-community/cli": Not Found
    installed: 18.2.0
    wanted: 18.2.0
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
  "*react-native*": Not Found
  hermesEnabled: Not found
  newArchEnabled: Not found
  hermesEnabled: Not found
  newArchEnabled: Not found

Before posting your question, make sure you’ve read the documentation for both EAS Build & Submit.

If your Android or iOS build is failing- make sure you do your own research on the error message first before posting (this will give you a better understanding, and you might even find that someone else has already solved the issue!) It is not up to the Expo team to debug your project or build.

In your post, please share:

  • Whether you are bare or managed workflow
  • Your eas-cli version
  • What you have tried so far

hi there! have you looked at the full xcode logs yet? there might be some more logs that you can find there to help out. you will see this at the bottom of your build page

the reason no bundle exists is that bundling your app is failing.

1 Like

Resolved! The build was failing due to some strange issues with gitignore files being excluded from the build. To anybody who is experiencing a similar problem, make sure that you check the Xcode logs, and look for the reason why the build was failing. It is most likely that the build failing is the reason that the bundle cannot be found.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.