13

I have project in React Native, and I'm not being able to build on the Android Studio due the following error.

Here's the detailed log with additional info:

java.io.IOException: Cannot run program "node" (in directory "/Users/fabioernanni/git/fintech-ewallet-mobile/android"): error=2, No such file or directory

java.io.IOException: error=2, No such file or directory

Cause: error=2, No such file or directory

I have tried to reinstall Node, Android Studio, to link the tscript library so the Android Studio would recognize the "node" but nothing seems to help.

Ernanni
  • 336
  • 1
  • 3
  • 13
  • Just as an aside, for some reason `node` was uninstalled or not available on my system. I may have upgraded things through `brew upgrade` and this is why `node` was no longer installed. It just so happened Android Studio was the first place I ran into this and so I just assumed it was Android Studio causing a ruckus when in fact it was my own fault. Might be helpful to others. – Joshua Pinter Jan 16 '23 at 22:36
  • Does this answer your question? [React Native on Android: Cannot run program "node": error=2, No such file or directory](https://stackoverflow.com/questions/61922174/react-native-on-android-cannot-run-program-node-error-2-no-such-file-or-dir) – Jadent Jul 27 '23 at 11:39

3 Answers3

29

I have a similar problem with Android Studio (bumble bee) version with node on My Mac M1 Chip 
so to solve this open your Android Studio from terminal
. To Open Android Studio from terminal on Mac m1 just open your Terminal and paste the following command

open -a /Applications/Android\ Studio.app

this will open your android studio and then you can open your project and can run build from android studio Note : be sure that Android studio is not running state if its running just Quite it and then launch from Terminal

2

Do these steps to solve it:-

STEP 1: First quit the android studio, if it is in a running state.

command + Q

STEP 2: Enable the permission for android studio printenv.

sudo chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv

STEP 3: Open android studio from terminal app.

open -a /Applications/Android\ Studio.app
Rohit Kumar
  • 728
  • 9
  • 13
0

Check which version of Gradle (specified in gradle-wrapper.properties) and the Android Gradle Plugin (in (build.gradle) that you are using.

Some versions can have known issues with specific versions of Android Studio.

This page provides more information: https://developer.android.com/build/releases/gradle-plugin

Jadent
  • 974
  • 8
  • 14