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

Unable to successfully run @nx/react-native:run-android #21212

Closed
1 of 4 tasks
NickFitton opened this issue Jan 18, 2024 · 4 comments · Fixed by #21725
Closed
1 of 4 tasks

Unable to successfully run @nx/react-native:run-android #21212

NickFitton opened this issue Jan 18, 2024 · 4 comments · Fixed by #21725
Assignees
Labels
outdated scope: react-native Issues relating to React Native type: bug

Comments

@NickFitton
Copy link

Current Behavior

Running nx run-android from the project root causes a failure.
Running nx run-ios from the project root is successful.

Expected Behavior

No failure when running react native run android.

GitHub Repo

https://github.com/NickFitton/nx-react-native-android

Steps to Reproduce

(can also be done with a freshly generated app)

git clone git@github.com:NickFitton/nx-react-native-android.git
cd nx-react-native-android
nx run-android mobile // This will work fine
cd apps/mobile
nx run-android // This will fail

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.17.0
   OS     : darwin-arm64
   npm    : 9.6.7
   
   nx (global)        : 17.0.3
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/detox          : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/react          : 17.2.8
   @nx/react-native   : 17.2.8
   @nrwl/tao          : 17.2.8
   @nx/web            : 17.2.8
   typescript         : 5.2.2

Failure Logs

>  NX   Running target run-android for project mobile and 2 tasks it depends on:

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

> nx run mobile:ensure-symlink


> nx run mobile:sync-deps

info Dependencies for 'mobile' are up to date! No changes made.

> nx run mobile:run-android


 >  NX   ENOENT: no such file or directory, chmod 'apps/mobile/android/gradlew'


Error: ENOENT: no such file or directory, chmod 'apps/mobile/android/gradlew'
    at chmodSync (node:fs:1991:3)
    at chmodAndroidGradlewFiles ({path to repro}/reproduction/node_modules/@nx/react-native/src/utils/chmod-android-gradle-files.js:8:24)
    at runAndroidExecutor ({path to repro}/reproduction/node_modules/@nx/react-native/src/executors/run-android/run-android.impl.js:11:63)
    at runAndroidExecutor.next (<anonymous>)
    at getLastValueFromAsyncIterableIterator ({path to repro}/reproduction/node_modules/nx/src/utils/async-iterator.js:13:27)
    at iteratorToProcessStatusCode ({path to repro}/reproduction/node_modules/nx/src/command-line/run/run.js:41:94)
    at {path to repro}/reproduction/node_modules/nx/src/command-line/run/run.js:155:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleErrors ({path to repro}/reproduction/node_modules/nx/src/utils/params.js:9:16)
    at async process.<anonymous> ({path to repro}/reproduction/node_modules/nx/bin/run-executor.js:59:28)

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

 >  NX   Running target run-android for project mobile and 2 tasks it depends on failed

   Failed tasks:
   
   - mobile:run-android
   
   Hint: run the command with --verbose for more details.

Package Manager Version

No response

Operating System

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

Additional Information

Looking at the functionality of run-android.impl.ts, it runs chmod without being context aware of the current directory.
I believe making this function aware of the current directory it's in would help resolve this issue.
I only raise this as an issue as functionality differs between run-ios and run-android.

@AgentEnder AgentEnder added the scope: react-native Issues relating to React Native label Jan 28, 2024
@xiongemi
Copy link
Collaborator

xiongemi commented Feb 8, 2024

@NickFitton i cloned your repo and i can run android. Did you run the command from the workspace root? i think it was trying to access apps/mobile/android/gradlew, which needs to run the command at workspace root.

@NickFitton
Copy link
Author

Apologies, I wasn't specific enough in the initial description, when I said:

Running nx run-android from the project root causes a failure.
Running nx run-ios from the project root is successful.

I meant the root of the react native app (apps/mobile). My assumption was that you could run these functions from the app location due to being able to run nx run-ios from the same place.

@xiongemi
Copy link
Collaborator

xiongemi commented Feb 8, 2024

i create a pr #21212 to change the gradlew path to be absolute so it can be ran in the project folder

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 Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants