EAS build fails on Prebuild step in a monorepo

We have a monorepo with a managed Expo app that we are trying to build using EAS. It keeps failing at the Prebuild step when building for iOS with the following error:

Prebuilding managed project
- Creating native project directories (./ios and ./android) and updating .gitignore
✔ Created native project
- Adding Metro bundler config
✔ Added Metro config
- Updating your package.json scripts, dependencies, and main file
[stderr] [14:59:43] Cannot convert undefined or null to object
- Updating your package.json scripts, dependencies, and main file
[stderr] [14:59:43] TypeError: Cannot convert undefined or null to object
[stderr]     at Function.assign (<anonymous>)
[stderr]     at updatePackageJSONDependencies (/usr/local/eas-build-worker/node_modules/expo-cli/src/commands/eject/updatePackageJson.ts:151:31)
[stderr]     at updatePackageJSONAsync (/usr/local/eas-build-worker/node_modules/expo-cli/src/commands/eject/updatePackageJson.ts:37:19)
[stderr]     at createNativeProjectsFromTemplateAsync (/usr/local/eas-build-worker/node_modules/expo-cli/src/commands/eject/createNativeProjectsFromTemplateAsync.ts:63:29)
[stderr]     at prebuildAsync (/usr/local/eas-build-worker/node_modules/expo-cli/src/commands/eject/prebuildAppAsync.ts:57:7)
[stderr]     at actionAsync (/usr/local/eas-build-worker/node_modules/expo-cli/src/commands/eject/prebuildAsync.ts:34:3)
- Updating your package.json scripts, dependencies, and main file
bash exited with non-zero code: 1

The app build locally so it must be something in EAS.

  • eas-cli v45.1
  • Yarn Berry v3.1.1
  • Manage workflow

We have tried to set env variable "YARN_ENABLE_IMMUTABLE_INSTALLS": "false" as suggested in another post, but still got the same error.

OK, we solved our own problem. The documentation for using EAS with a monorepo is a little confusing. We had to completely ignore both the setup from byCedric/eas-monorepo-example as well as using expo-yarn-workspaces and just followed the directions from Creating your first build - Expo Documentation.

The other key element that was confusing in the docs was that eas build needed to be run from the directory of the managed app and not the monorepo root. So apps/my-app. Once we cleaned out all the extraneous setup from the old examples it works great.

thanks for the follow up! i’ve updated the docs to point to our monorepo setup guide. the reason you need to run eas build from the app directory is that you may have multiple apps in a monorepo.