EAS Local Build fails with Monorepo SDK 47, EAS-CLI 3.0.0

I’m using SDK47, with eas-cli 3.0.0. I followed the tutorial to set up a monorepo found here:

The example works great in Expo Go but it fails when I try to build this locally with EAS build. I’m running the following command from the root of the app (so /apps/cool-app/):

eas build --profile development-simulator --platform ios --local

For reference, my eas.json has the following:

{
  "build": {
    "development-simulator": {
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    }
  }
}

The problem occurs right away on the [INSTALL_DEPENDENCIES] step. During this step, when trying to resolve packages, the process throws an error saying that ‘cool-package-2’ is not found (note I changed cool-package’s name from the tutorial to cool-package-2). Weirdly, it’s trying to look for cool-package-2 in the registry instead of locally. I changed the name of the package in the tutorial to cool-package-2 because, crucially, there is already an NPM package named cool-package which makes the EAS build not throw an error.

As a sidenote, I thought during the EAS build, it would package the whole of the monorepo, but I’m noticing that it’s only packaging my App folder. I noticed this by running:

eas build:inspect --platform ios --stage archive --output somepath --profile development-simulator

Thanks in advance for any help you can provide.

refer to this guide for info on how to use EAS Build with a monorepo: Integrating with third-party tooling - Expo Documentation

if you’re still having issues, let us know any other info you can share. also, this guide explains our recommended approach for working with monorepos in Expo projects in general

Thanks for replying - I’ve read both guides. I’ve followed them both in getting to the point where I submitted this error. I don’t have anything in the repo aside from the information from the guides.

Maybe I missed something specific from the “integrating with third-party tooling” documentation… but it doesn’t really seem like I needed to do anything extra aside from running eas build from the app’s root directory, which I am. The post-install step that was mentioned doesn’t seem to apply since the “cool-package” doesn’t have anything but the declaration and export of a variable. Is there anything else that needs to be done in order for EAS build to work?

i don’t believe it’s the case that your monorepo is similar to the guide, otherwise we would be able to find the root of the monorepo properly.

  • you are using git in your repo, right?
  • does your app within the monorepo have its own git repo possibly?

also, are you using npm or yarn?

here is the logic we use for finding the workspace root: expo/nodeWorkspaces.ts at 161ac2d295db29f85f2ee94c97f7d103e981845b · expo/expo · GitHub

here is the code that runs when you run build:inspect --stage archive: eas-cli/inspect.ts at a53e1f916f0ca59e8dd322ce504951927fd6d551 · expo/eas-cli · GitHub

here is where we make the shallow copy for the archive for git repos: eas-cli/git.ts at 2aade4c0c82665f12cd8053d339122fb35f56168 · expo/eas-cli · GitHub

most likely you are using the “no commit” approach for shallow copy (default), which is implemented here: eas-cli/gitNoCommit.ts at 2aade4c0c82665f12cd8053d339122fb35f56168 · expo/eas-cli · GitHub

so, run git rev-parse --show-toplevel from your app directory and i suspect it’ll return the exact path to your app directory rather than the root of the monorepo, and that is the problem

1 Like

Can’t thank you enough for your help, Brents.

In making a git repo to share more info about the issue I realized what was the problem (which is exactly what you point out):

  • The “Working with Monorepos” Guide suggests running yarn create expo-app apps/cool-app in order to get started. However, that sets up a git repo, which now made me realize that, as you point out, is interfering with the Eas build process. It’s only packaging that apps’ folder instead of the entire monorepo directory, which in turn means it doesn’t find “cool-package-2”.

I hadn’t committed anything to git prior to our conversation because I was simply testing out the monorepo functionality along with EAS build. I didn’t realize that the two are linked - the latter uses git as a reference even if you’re just building everything locally.

Thanks again for your help!

1 Like

great catch! it sounds like there was a regression there - we should not be initializing a git repo inside of an existing git repo