EAS Build error (IOS)

When running eas build, I’m getting a fastlane build command failure. I can successfully build a release archive (.ipa) in XCode, so I’m not sure what issue I’ve ran into with eas build. I do have file reference issues it appears in XCode, but they’re not blocking to my XCode build.

[13:36:59]: ▸ The following build commands failed:


218Mon, 08 Feb 2021 21:36:59 GMT

[13:36:59]: ▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/redditalerts-{{KEY}}/Build/Intermediates.noindex/ArchiveIntermediates/redditalerts/IntermediateBuildFilesPath/redditalerts.build/Release-iphoneos/redditalerts.build/Script-00DD1BFF1BD5951E006B06BC.sh

219Mon, 08 Feb 2021 21:36:59 GMT

[13:36:59]: ▸ (1 failure)

220Mon, 08 Feb 2021 21:36:59 GMT

** ARCHIVE FAILED **

this means that your bundle is failing to compile. maybe you have a .env file on your machine but that’s not being uploaded (only files that aren’t .gitignore are uploaded) and so it fails to import, or something like that. try freshly cloning your project to another directory and building to see a similar error, most likely

1 Like

Thanks Brent, I know these questions must get routinely annoying and I appreciate your help.

The EAS ‘XCode logs’ shows a failing import, although it imports (and builds) locally with XCode and also via react-native run-ios. I do not have a custom metro config, and didn’t have one before or after I ejected to Bare.

Error: Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. Unable to resolve module ./BuyModal from /Users/expo/project/build/screens/index.js:

it looks like you are unable to load a file called BuyModal.js from build/screens/index.js

i can’t really help with that, it is very specific to your project. perhaps you called it buymodal.js and committed it to git and then renamed it to BuyModal.js without using git mv? rename - Changing capitalization of filenames in Git - Stack Overflow

1 Like

Hi Brent,

I took your advice of copying the repo and remaking Xcode project file from scratch and it finally built on EAS. Thank you.

1 Like

It seemed to be an issue with an outdated main.bundle.js.For others experiencing a file import error in Fastlane (used by EAS), but not in XCode, here’s what I did:

  1. yarn start --reset cache
  2. Delete podfile.lock and pods folder
  3. npx pod-install --repo-update
  4. Run react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios with whatever your entry file is. Your entry file should be index.js by default with an expo app, if it’s not, look for where you have registerRootComponent(App). I made this into a package.json script since I use it often.
  5. Then, run eas build -p ios
1 Like

error: /Users/expo/workingdir/build/ios/main.jsbundle: No such file or directory (in target 'redditalerts' from project 'redditalerts')

Hi @notbrent, I’m encountering another fastlane error (above) during eas build -p ios. I tried running my above fix and also confirmed that I’m seeing the main.jsbundle in my XCode’s “Bundle Resources”, but not sure if this matters.

I can build my app locally with XCode, and it’s a bare workflow expo app (v 40).
image

@notbrent sorry for the ping, any ideas on a fix?

hi there! you should get your build running locally and then try again on eas build. change your scheme build configuration to release and build locally to try it out. keep in mind that eas build cannot successfully build apps that are in a bad state and don’t build in the first place

you might be seeing this error if your project is failing to compile the js bundle at all. you can refer to your logs to see more information, or share your build details page and i’ll point you to the appropriate place

Thank you @notbrent. It does run locally, but only sometimes. it appears that when i run eas build:configure for iOS, it adds these two lines under my Build Phases / “Bundle React Native code and images”

./node_modules/expo-updates/scripts/create-manifest-ios.sh
../node_modules/expo-updates/scripts/create-manifest-ios.sh

The first line is correct, but the second is looking to the wrong (parent) directory. If I delete the second line, I can build the app with XCode. However, if I try to run eas build:configure, I get…
Error: Path to expo-updates/scripts/create-manifest-ios.sh is missing in a "Bundle React Native code and images" build phase.

So, I run eas build:configure again and it adds the faulty line of code.

i can’t reproduce that - i can run eas build:configure as many times as i want and it does not add that config again.

it should be ../node_modules/expo-updates/scripts/create-manifest-ios.sh indeed because it is relative to the ios directory. it may be adding it because you changed this manually?

are you using the latest version of eas-cli?

Yes, I am using v2.1.1 of eas-cli. I did not manually edit this in XCode. Maybe it’s this first line below that allows for the other same-director paths to work? In either case, I’m not sure why it adds two create-manifest-ios.sh lines of code. If it helps, here are the real evant files:

Bundle React Native code and images

**cd** $PROJECT_DIR/ ..
**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
../node_modules/expo-updates/scripts/create-manifest-ios.sh

metro.config.js


module.exports = createMetroConfiguration(__dirname);

package.json

{
  "main": "__generated__/AppEntry.js",
  "scripts": {
    "start": "react-native start",
    "web": "expo start --web --https",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "eject": "expo eject",
    "bundle:ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",
    "deploy:web": "expo build:web && cd web-build && vercel --prod  && cd ..",
    "deploy:ios": "EXPO_APP_STORE_DEBUG=true EXPO_NO_CAPABILITY_SYNC=1 eas build --platform ios",
    "configure": "eas build:configure",
    "postinstall": "expo-yarn-workspaces postinstall"
  },
  "dependencies": {
    "@eva-design/eva": "^2.0.0",
    "@expo/webpack-config": "^0.12.52",
    "@invertase/react-native-apple-authentication": "^2.1.2",
    "@react-native-async-storage/async-storage": "^1.13.2",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/segmen ted-control": "^2.2.2",
    "@react-navigation/bottom-tabs": "^5.11.2",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "@sanar/react-native-highlight-text": "^1.0.2",
    "@ui-kitten/components": "^5.0.0",
    "@ui-kitten/eva-icons": "^5.0.0",
    "dayjs": "^1.10.1",
    "expo": "~40.0.0",
    "expo-app-auth": "~9.3.0",
    "expo-apple-authentication": "~2.2.2",
    "expo-auth-session": "~3.0.0",
    "expo-clipboard": "~1.0.1",
    "expo-constants": "~9.3.3",
    "expo-linking": "~2.0.0",
    "expo-notifications": "~0.8.2",
    "expo-random": "~10.0.0",
    "expo-secure-store": "~9.3.0",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-updates": "~0.4.1",
    "global": "^4.4.0",
    "jwt-decode": "^3.1.2",
    "react": "16.13.1",
    "react-apple-signin-auth": "^0.1.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.4",
    "react-native-gesture-handler": "~1.9.0",
    "react-native-onboarding-swiper": "^1.1.4",
    "react-native-purchases": "^4.1.2",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.0",
    "react-native-stripe-checkout-webview": "0.0.13",
    "react-native-svg": "12.1.0",
    "react-native-unimodules": "~0.12.0",
    "react-native-video": "^5.1.1",
    "react-native-web": "~0.13.12",
    "react-native-web-webview": "^1.0.2",
    "react-native-webview": "^11.6.2",
    "remark": "^13.0.0",
    "strip-markdown": "^4.0.0"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "babel-jest": "~25.2.6",
    "eslint": "^7.19.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "expo-yarn-workspaces": "^1.5.2",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.13.1"
  },
  "private": true,
  "name": "reddit-app",
  "version": "1.0.1"
}

oh i see - this is in a monorepo. fyi - you don’t need to run build:configure more than once! so if it isn’t configuring properly when you run it, just go and modify it manually and save and then you don’t need to run it again. if you see a warning about it not being configured then indeed something is wrong.

please try to create a minimal reproducible example you can share with me so we can resolve the issue

Here’s my latest issue:

▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ 	CpResource /Users/expo/workingdir/build/ios/main.jsbundle /Users/expo/Library/Developer/Xcode/DerivedData/redditalerts-gwnidptllxaakidlxnvcuabsswzl/Build/Intermediates.noindex/ArchiveIntermediates/redditalerts/InstallationBuildProductsLocation/Applications/reddit-alerts.app/main.jsbundle
▸ (1 failure)
** ARCHIVE FAILED **

I’m not using a monorepo- I had tried using the expo-yarn-workspace as a last-ditch attempt to fix the Fastlane bundling issue. I removed it this morning and invited you to my private github. The code is building on XCode but still failing on Fastlane.

Thanks so much for your fast and thorough replies. I do try and research the issues I encounter, but feel like I’m missing knowledge on the React-Native/Eas build process needed to diagnose issues better. Is there an end-to-end guide you can link me to?

we document the entire build process (as it pertains to eas) here: iOS build process - Expo Documentation

you should get your project running locally before trying to build on eas. it looks like if you run npx react-native run-ios --configuration Release it will fail.

as for adding me to the repo, i think you invited my expo email, which i don’t use and just holds a placeholder github account - my github user account is actually brentvatne

Hi Brent, I think I did invite your personal account. I will read the documentation now. I did run the command you pasted and it worked, but without the configure flag. https://github.com/pakaplace/reddit-alerts/invitation

Hi Brent, I can succesfully build the app with both xcode and npx react-native run-ios --configuration Release, but I’m still getting this error with eas build-
:x: error: /Users/expo/workingdir/build/ios/main.jsbundle: No such file or directory (in target ‘redditalerts’ from project ‘redditalerts’)

@notbrent , did you have a chance to check it out? I can builld using xCode and the react-native run-ios --configuration Release command, but still can’t successfuly build wiith EAS. I feel bad taking up your time on a simple/frustrating issue, so if you know of a freelancer I could pay insttead I’d be happy to do that.

hey there. sorry this slipped off of my radar. did you end up finding a solution?

Hi. I tried so many things I’m not sure what fixed it, but this is what my build script looks like now
"deploy:ios": "npm run bundle:ios && eas build --platform ios", "bundle:ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",