Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAS build fails for clean nx + expo app apparently due to missing dependencies, yet pre/post hooks run without issues #22195

Closed
1 of 4 tasks
rudfoss opened this issue Mar 7, 2024 · 4 comments
Assignees
Labels

Comments

@rudfoss
Copy link

rudfoss commented Mar 7, 2024

Current Behavior

Running EAS build for an Expo app in a monorepo fails. The cause seems to be that the eas-build-pre-install and eas-build-post-install do not take effect correctly and the default package.json file in the app is used instead of the full one.

Expected Behavior

Eas build should work using a newly generated expo app in an Nx monorepo.

GitHub Repo

https://github.com/rudfoss/nx-expo-test

Steps to Reproduce

See readme of repro repo

  1. Create workspace
pnpm create create-nx-workspace@latest nx-expo-test --workspaceType=integrated --nxCloud=skip --preset=apps --defaultBase=main
  1. Update .npmrc
strict-peer-dependencies=false
auto-install-peers=true
node-linker=hoisted # added to ensure babel works
  1. Reinstall dependencies
pnpm i
  1. Install expo plugin
pnpm exec nx add @nx/expo
  1. Generate expo app
pnpm exec nx generate @nx/expo:application --name=nx-expo-test --directory=apps/nx-expo-test --displayName=NxExpoTest --e2eTestRunner=playwright --projectNameAndRootFormat=as-provided --no-interactive
  1. Add eas-cli dependency
pnpm add -D eas-cli
  1. Add eas project id and identifiers to app.json
"ios": {
  "bundleIdentifier": "com.thr.nxexpotest"
},

"android": {
  "package": "com.thr.nxexpotest"
},

"extra": {
  "eas": {
    "projectId": "b9e09a49-29bb-459c-9984-1998087378b7"
  }
}
  1. Login and run EAS build for Android (generate new Android Keystore if prompted)
pnpm exec eas login
pnpm exec nx run nx-expo-test:build -- --platform android
  1. Build fails due to missing dependencies

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.9.0
OS     : win32-x64
pnpm   : 8.15.4

nx                 : 18.0.7
@nx/js             : 18.0.7
@nx/jest           : 18.0.7
@nx/linter         : 18.0.7
@nx/eslint         : 18.0.7
@nx/workspace      : 18.0.7
@nx/devkit         : 18.0.7
@nx/eslint-plugin  : 18.0.7
@nx/expo           : 18.0.7
@nx/playwright     : 18.0.7
@nx/react          : 18.0.7
@nrwl/tao          : 18.0.7
@nx/web            : 18.0.7
@nx/webpack        : 18.0.7
typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This might be an issue with the EAS build agents directly, but it is hard to debug as I cannot easily see the full file structure to determine if the package.json file is correct. The pre and post hooks seem to work without issues.

@rudfoss
Copy link
Author

rudfoss commented Mar 7, 2024

Issue open on expo-cli: expo/eas-cli#2267

@rudfoss
Copy link
Author

rudfoss commented Mar 7, 2024

It appears that the .npmrc file is required for the installation on EAS to run correctly. Once I copied the .npmrc file to the nx-expo-test root folder the build works. Maybe that should also be part of the generator for pnpm-based repos?

.npmrc

strict-peer-dependencies=false
auto-install-peers=true
node-linker=hoisted

apps/nx-expo-test/package.json

Add && cp .npmrc apps/nx-expo-test to the end of the eas-build-pre-install script so that it is also copied along with the lock file.

{
  "name": "nx-expo-test",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "@testing-library/jest-native": "*",
    "@testing-library/react-native": "*",
    "metro-config": "*",
    "react-native": "*",
    "expo": "*",
    "react-native-svg": "*",
    "react-native-web": "*"
  },
  "scripts": {
    "eas-build-pre-install": "cd ../../ && node tools/scripts/eas-build-pre-install.mjs . apps/nx-expo-test && cp pnpm-lock.yaml apps/nx-expo-test && cp .npmrc apps/nx-expo-test",
    "eas-build-post-install": "cd ../../ && node tools/scripts/eas-build-post-install.mjs . apps/nx-expo-test"
  }
}

@FrozenPandaz FrozenPandaz added the scope: react-native Issues relating to React Native label Mar 15, 2024
Copy link

This issue has been automatically marked as stale because it hasn't had any activity for 6 months.
Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore.
If at this point, this is still an issue, please respond with updated information.
It will be closed in 21 days if no further activity occurs.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Sep 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants