zeesh 2142
zeesh 2142

Reputation: 21

react native spawnSync $HOME/Android/Sdk/platform-tools/adb ENOENT at Object.spawnSync

I am getting the below error while trying to run the following command : sudo react-native run-android

I have tried all the approches from here but to no avail: React Native adb reverse ENOENT

Moreover the problem did not occur when I run the same command without using sudo ,I further tried updating adb and copying the root Android folder to $USERS/Android but none of the approaches worked . Would be very great if I could recieve some help in this

debug Running command "$HOME/Android/Sdk/platform-tools/adb -s f4de483e reverse tcp:8081 tcp:8081"
warn Failed to connect to development server using "adb reverse": spawnSync $HOME/Android/Sdk/platform-tools/adb ENOENT
info Starting the app on "f4de483e"...
debug Running command "$HOME/Android/Sdk/platform-tools/adb -s f4de483e shell am start -n com.grej_frontend/com.grej_frontend.MainActivity"
error Failed to start the app.
Error: spawnSync $HOME/Android/Sdk/platform-tools/adb ENOENT
    at Object.spawnSync (internal/child_process.js:1002:20)```

Upvotes: 2

Views: 5811

Answers (2)

zeesh 2142
zeesh 2142

Reputation: 21

The error was that there was a seperate .bashrc file for sudo user which I was not updating. Updating that file with proper paths fixed my error.

Upvotes: 0

I have the same problem and I noticed that my ~/.bashrc file had a different path like the following

export PATH=$PATH:/usr/local/opt/android-sdk/tools:/usr/local/opt/android-sdk/platform-tools

Then I removed it and I kept the following and it was fixed:

export ANDROID_HOME=$HOME/Android/Sdk
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Upvotes: 4

Related Questions