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 from nx-monorepo due to missing dependencies, yet hook that should fix package.json runs without issues #2267

Closed
rudfoss opened this issue Mar 7, 2024 · 5 comments
Labels
issue accepted needs review Issue is ready to be reviewed by a maintainer

Comments

@rudfoss
Copy link

rudfoss commented Mar 7, 2024

Build/Submit details page URL

https://expo.dev/accounts/thomas.rudfoss/projects/nx-expo-test/builds/6d89456f-b009-4a08-add9-ac1cb8cabeb0

Summary

Created a new nx monorepo with the official expo plugin. The app runs fine during development, but eas build fails apparently because dependencies cannot be properly installed.

Nx comes with pre and post install hooks that should update the package.json file to include the necessary dependencies, but based on the Read package.json step output this does not seem to take effect even though the pre/post hook steps report no issues.

Managed or bare?

managed

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: Windows 11 10.0.22635
    Binaries:
      Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: AI-231.9392.1.2311.11076708
    npmPackages:
      @expo/metro-config: ~0.17.3 => 0.17.6
      babel-preset-expo: ~10.0.0 => 10.0.1
      expo: ~50.0.3 => 50.0.11
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.73.2 => 0.73.2
      react-native-web: ~0.19.9 => 0.19.10
    Expo Workflow: managed

Error output

No response

Reproducible demo or steps to reproduce from a blank project

Fully reproducible repo here: https://github.com/rudfoss/nx-expo-test

@rudfoss
Copy link
Author

rudfoss commented Mar 7, 2024

Issue open on nx: nrwl/nx#22195

@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.

This seems to be an issue with the nx-generator so maybe this issue can be closed, but it seems that the build agent output for the Read package.json step should respect that the pre-install hook changed the file which it currently does not seem to do.

.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"
  }
}

@szdziedzic
Copy link
Member

Hey, I think you are right, the build agent output for the Read package.json step should respect that the pre-install hook changed the file 👍

@expo-bot
Copy link
Contributor

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@szdziedzic
Copy link
Member

Should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue accepted needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants