EAS Build error (iOS only)

I’m working on a bare expo app and I’m working to covert the repo into a monorepo with the original repo code having been moved into a package folder.

I’ve been able to sort out all but one of my issues: namely an error specific to iOS EAS builds. I can get the app to build locally on iOS and Android, as well as via EAS on Android. The error I’m getting is:

› Executing ConnectionsNext » Bundle React Native code and images
    the transform cache was reset.

❌  error: File /Users/expo/Library/Developer/Xcode/DerivedData/EasYarnMonorepo-evdnshdyybmkzwcqtrugkzxdarjk/Build/Intermediates.noindex/ArchiveIntermediates/EasYarnMonorepo/BuildProductsPath/Release-iphoneos/EasYarnMonorepo.app/main.jsbundle does not exist. This must be a bug with

Thinking the app entry point wasn’t working correctly on iOS, I tried a whole bunch of different things but nothing worked. I’ve come to understand that a lot of the examples out there are applicable to using expo-yarn-workspaces with managed builds and aren’t really applicable to me. I’ve created a minimal reproducible example at: GitHub - bkensey/eas-yarn-monorepo. Getting it working should just require yarn install in the folder root and then running pod install in the lone package/expo-bare/ios directory.

I’d greatly appreciate any help in wrapping my head around this one, because it’s got me thoroughly stumped. Note: when checking build logs behind the scenes, the relevant builds weren’t completed under my account but rather under mpotts. Haven’t converted that account to an organization yet, but I’m thinking I should soon.

Hey @bkensey , I think this has to do with the Xcode build scripts that React Native uses by default. Since your app is bare, you have direct access to these files and can modify them to point to the correct files (open up the .xcworkspace file in your ios directory, this will open Xcode, and you can go to the build scripts pane)

BTW, think this is the same as this post- Eas build for ios fails at fastlane step - no main.jsbundle:

I think you’re right that this has to do with the build scripts. I did stumble across that other post and I also suspect its the same or a similar issue, but unfortunately the poster didn’t go into any detail about what resolved his issue.

When you say I can modify the scripts to reference the correct files, I think you’re talking about eas-yarn-monorepo/project.pbxproj at main · bkensey/eas-yarn-monorepo · GitHub, and in particular the line at 210:

shellScript = "export NODE_BINARY=node BUNDLE_CONFIG=packages/native-app/metro.config.js\n../../../node_modules/react-native/scripts/react-native-xcode.sh\n../../../node_modules/expo-constants/scripts/get-app-config-ios.sh\n../../../node_modules/expo-updates/scripts/create-manifest-ios.sh\n../../../node_modules/expo-updates/scripts/create-manifest-ios.sh\n";

I can’t figure out what should be changed. I have an index.js file in place, and that’s the default supplied by create-manifest-ios.sh. I have symlinks in place for all of the packages referenced in that shellScript assignment. I’ve tried manually setting various things but nothing has worked so far.

I noticed that I had a duplicate line in that shell script, but removing it didn’t fix the issue. I’ve tried removing the “…/…/” from each of the script references so as to point at the symlinked package/expo-bare node_modules folder rather than the one at the root (to match the example at GitHub - byCedric/eas-monorepo-example: An example monorepo for EAS or just Expo usage), but if I do that I get another error:

expo-updates module is not configured. Please run "eas build:configure" first to configure the project
    Error: Path to expo-updates/scripts/create-manifest-ios.sh is missing in a "Bundle React Native code and
     images" build phase.

using eas build for managed apps with monorepos is a bit tricky right now. the error you can see above means it looks like some symlink was missing.

the repo linked to above (eas-monorepo-example) is a good reference, also examples/with-yarn-workspaces at master · expo/examples · GitHub is too. npx crna -t with-yarn-workspaces will build out of the box on eas build. you can compare your configuration to this.

we’re working on improving the ergonomics of workspaces on eas build, hopefully we will have some considerable improvements ready by sdk 43

thank you for your answer this is really helpful for me

Ah HAH! Success!

I tried a few more things based on @brents feedback, and after some trial and error I’ve boiled it down to the two steps that got things working for me:

First, adding some extra config to the top level package.json is key. Specifically:

 "react-native-unimodules": {
    "android": {
      "modulesPaths": [
        "../../../../",
        "../../../../packages"
      ],
      "configuration": "api",
      "target": "react-native"
    },
    "ios": {
      "modules_paths": [
        "../../../",
        "../../../packages"
      ],
      "flags": {
        "inhibit_warnings": false
      }
    }
  }

(With the paths updated to match your actual setup. At least for now, my react native app is entirely self contained, so I took out the “…/…/…/packages” references.)

Second, in the project.pbxproj file I mentioned above (@line 210), I needed to mix up the references a bit, where the first two scripts in the shellScript string references the package level node_modules, and the third script matches the top level node_modules script, as seen here:

shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n../node_modules/expo-constants/scripts/get-app-config-ios.sh\n../../../node_modules/expo-updates/scripts/create-manifest-ios.sh\n";

or, if you’re entering the value directly into xcode:

 export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
../node_modules/expo-constants/scripts/get-app-config-ios.sh
../../../node_modules/expo-updates/scripts/create-manifest-ios.sh

And voila! Run yarn install at the repo root, and then pod install in your package/ios directory.

Thanks @brents! Never would have figured it out without your suggestion.