nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.54k stars 2.35k forks source link

@nx/expo:build for eas local is failing with yarn v4. Unknown error. See logs of the Install dependencies build phase for more information. #28121

Open alifa20 opened 1 month ago

alifa20 commented 1 month ago

Current Behavior

Eas local build is failing and cannot proceed.

Expected Behavior

Should be able to build with EAS locally.

GitHub Repo

https://github.com/alifa20/issue-demos/tree/main/nx-expo-eas-issue

Steps to Reproduce

  1. create a new workspace, or git clone https://github.com/alifa20/issue-demos && cd nx-expo-eas-issue
  2. yarn install
  3. yarn nx run nx-expo-app:build:ios:local

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.16.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.5.0

nx (global)        : 19.8.0
nx                 : 19.8.2
@nx/js             : 19.8.2
@nx/jest           : 19.8.2
@nx/linter         : 19.8.2
@nx/eslint         : 19.8.2
@nx/workspace      : 19.8.2
@nx/devkit         : 19.8.2
@nx/eslint-plugin  : 19.8.2
@nx/expo           : 19.8.2
@nx/react          : 19.8.2
@nrwl/tao          : 19.8.2
@nx/web            : 19.8.2
@nx/webpack        : 19.8.2
typescript         : 5.3.3
---------------------------------------
Registered Plugins:
@nx/expo/plugin
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

[INSTALL_DEPENDENCIES] Running "yarn install" in /var/folders/hn/s06rnn710y73bfpg0jrspkh80000gn/T/eas-build-local-nodejs/981bb4cd-f219-4b30-b0f9-7fa6e78dd6d6/build/nx-expo-eas-issue/apps/nx-expo-app directory
[INSTALL_DEPENDENCIES] ➤ YN0000: · Yarn 4.5.0
[INSTALL_DEPENDENCIES] ➤ YN0000: ┌ Resolution step
[INSTALL_DEPENDENCIES] ➤ YN0085: │ - @nx-expo-app-org/source@workspace:.
[INSTALL_DEPENDENCIES] ➤ YN0000: └ Completed
[INSTALL_DEPENDENCIES] ➤ YN0000: ┌ Post-resolution validation
[INSTALL_DEPENDENCIES] ➤ YN0060: │ eslint is listed by your project with version 9.11.1 (pb1026), which doesn't satisfy what eslint-plugin-import and other dependencies request (^8.0.0).
[INSTALL_DEPENDENCIES] ➤ YN0002: │ nx-expo-app@workspace:. doesn't provide @babel/core (pca629), requested by babel-jest and other dependencies.
[INSTALL_DEPENDENCIES] ➤ YN0002: │ nx-expo-app@workspace:. doesn't provide @typescript-eslint/parser (p14fad), requested by @nx/eslint-plugin and other dependencies.
[INSTALL_DEPENDENCIES] ➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
[INSTALL_DEPENDENCIES] ➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
[INSTALL_DEPENDENCIES] ➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
[INSTALL_DEPENDENCIES] ➤ YN0000: └ Completed
[INSTALL_DEPENDENCIES] ➤ YN0000: · Failed with errors in 0s 214ms
[INSTALL_DEPENDENCIES]
Error: yarn install exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)
    at Object.onceWrapper (node:events:634:26)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Pipe.<anonymous> (node:net:339:12)
    ...
    at spawnAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at spawn (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/turtle-spawn/dist/index.js:16:47)
    at installDependenciesAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/common/installDependencies.js:24:50)
    at async runInstallDependenciesAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/common/setup.js:148:50)
    at async /Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/common/setup.js:57:9
    at async BuildContext.runBuildPhase (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/context.js:107:28)
    at async setupAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/common/setup.js:56:5)
    at async buildAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/builders/ios.js:47:5)
    at async runBuilderWithHooksAsync (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/builders/common.js:12:13)
    at async Object.iosBuilder (/Users/ali/.npm/_npx/93986e4ba4ec11e8/node_modules/@expo/build-tools/dist/builders/ios.js:33:16)

Build failed
Unknown error. See logs of the Install dependencies build phase for more information.
npx exited with non-zero code: 1
    Error: build command failed.

 NX   1

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran target build:ios:local for project nx-expo-app (25s)

Package Manager Version

yarn 4.5.0

Operating System

Additional Information

NX 19.6.4 was working fine and this workaround ^ seemed to be working, but the new version of NX has caused issues.

I tried running the following code from the root:

node tools/scripts/eas-build-pre-install.mjs . apps/nx-expo-app && cp yarn.lock apps/nx-expo-app/

But still no success

xiongemi commented 4 days ago

i created a pr in your repo: https://github.com/alifa20/issue-demos/pull/2

To summarize: I think the issue is that with yarn 4, it does not allow installation with the current structure if it is not a yarn workspace. to workaround, I move the yarn.lock from root to project so yarn install can be ran. however, there is going to be changes in yarn.lock file and that failed yarn install. you can add .env and set YARN_ENABLE_IMMUTABLE_INSTALLS=false.