I’m having trouble with my GitHub Actions workflow for an Expo React Native app. The build keeps failing because it’s trying to use npm instead of pnpm.
My project is set up with pnpm and has the only-allow package to enforce its use. But when the Expo action runs, it still tries to use npm install. This causes an error telling me to use pnpm instead.
I’ve already set up pnpm in my workflow file. It installs pnpm and runs pnpm install for dependencies. But somehow, Expo’s remote build environment is still defaulting to npm.
Is there a way to make Expo use pnpm on their end? Maybe a setting in eas.json or some other config file? I’m not sure how to tell Expo to switch from npm to pnpm for the remote build process.
Any ideas on how to fix this would be super helpful. I’m stuck and can’t figure out how to get my builds working again.
The key here is setting EXPO_USE_PNPM to ‘1’. This environment variable should instruct Expo to use pnpm instead of npm during the build process.
Also, make sure your workflow file sets this environment variable:
env:
EXPO_USE_PNPM: 1
These changes forced Expo to recognize pnpm in my setup. Give it a shot and see if it resolves your issue. If not, you might need to reach out to Expo support for more specific guidance on their build environment.
Having dealt with Expo and pnpm in CI environments before, I can suggest another approach that might resolve your issue. Instead of relying solely on environment variables, you could try modifying your project’s package.json file to include a custom Expo CLI command that forces the use of pnpm.
Add this to your package.json scripts:
“build”: “EXPO_USE_PNPM=1 expo build:android”
Then, in your GitHub Actions workflow, use this custom script instead of calling expo directly:
pnpm run build
This method explicitly sets the EXPO_USE_PNPM flag when invoking Expo CLI, which should override any default behavior in their build environment. It’s worked for me in similar situations where Expo was stubbornly defaulting to npm.
If this doesn’t solve it, you might need to investigate if there are any conflicting npm-related configurations in your project or CI setup that are overriding your pnpm settings.