EAS Install using Yarn instead of pnpm

Hi all,

I’m using a pnpm monorepo and trying to build my expo project on EAS (iOS only right now). From a previous topic + the iOS builds doc, I would expect the install dependencies step to use pnpm, but my builds are attempting to run yarn install after the pre-install hook.

I know that full pnpm monorepo support is out of scope, but I was wondering if there was something I was missing for the install step to pick up my package manager (or allow me to just cancel / no-op the step so that we can macgyver it with pre-install/post-install hooks.

A bit more information:

  • pnpm monorepo managed with Rush
  • .npmrc with node-linker:hoisted
  • I’m running expo commands from my app directory
  • Was trying to use eas-build-pre-install and eas-build-post-install hooks to install and build the project using rush/pnpm
  • My package.json is being picked up correctly by EAS, here is a condensed version:
{
    "name": "@myCo/expo-app",
    "version": "1.0.0",
    "private": true,
    "main": "index.js",
    "scripts": {
        "_phase:build": "tsc",
        "build": "tsc",
        "dev": "expo start",
        "eas-build-post-install": "node ../../../common/scripts/install-run-rush.js build --to @myCo/expo-app",
        "eas-build-pre-install": " node ../../../common/scripts/install-run-rush.js install --to @myCo/expo-app",
        "expo": "expo",
        "ios": "expo run:ios"
    },
    "dependencies": {
        "@babel/core": "^7.15.0",
        "@babel/runtime": "~7.20.13",
        "@myCo/package1": "workspace:*",
        "@myCo/package2": "workspace:*",
        ...
    },
    "devDependencies": {
        "@babel/core": "^7.15.0",
        "@rnx-kit/metro-config": "~1.3.5",
        "@rnx-kit/metro-resolver-symlinks": "~0.1.25",
        ...
    }
}

pnpm is supported, we will run pnpm install if there is a pnp lockfile in the repo.

If it’s not happening for you, then it’s possible that you either have both yarn.lock and pnpm-lock.yaml
or you don’t have any lockfiles.

I certainly have a pnpm-lock file and do not have any yarn lock files (running find . -name yarn.lock from the root of the monorepo only finds matches for installed node modules).

Does EAS look for the lock files in any particular place? Or is there any way that I can see the set of files that eas build bundles and sends to the server in order to confirm that the lock file is being included?

I’ve forked the CLI and modified it to not delete the bundled files. This has confirmed that the pnpm lock file is included in the tarball sent to the server.

I’m digging through the expo repos to try and find an answer myself but wanted to bump the question about the expected lock file location.

EDIT: I’ve added a symlink from REPO_ROOT/pnpm-lock.yaml to the location of my lockfile in an effort to fix, but EAS still is running yarn install

You can use eas build:inspect --stage archive to verify what gets uploaded. Lockfile is expected to be in root of the workspace. Maybe the problem is that we can’t find root of the workspace, do you have pnpm-workspace.yaml?

This is the function used to resolve package manager to be used. expo/nodeManagers.ts at main · expo/expo · GitHub

This is the function that is looking for workspace root expo/nodeWorkspaces.ts at main · expo/expo · GitHub

1 Like