spawnSync ./gradlew EACCES error when running react native project on emulator udara

dudeperryfect picture dudeperryfect · Feb 5, 2019 · Viewed 59.4k times · Source

I am trying to use react-native run-android to install my react-native application on an android studio emulator. I have checked with abd-devices that the emulator is available, and I have ran npm-install.

I am using Ubuntu 18.04 with the latest version of android studio, and the latest Pixel 2 XL API 28.

I get the following error:

spawnSync ./gradlew EACCES

Error: spawnSync ./gradlew EACCES
    at Object.spawnSync (internal/child_process.js:998:20)
    at spawnSync (child_process.js:622:24)
    at Object.execFileSync (child_process.js:650:13)
    at runOnAllDevices (/home/user/react/front-end/project/node_modules    /react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/home/user/react/front-end/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/home/user/react/front-end/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

I have tried restarting my PC and the emulator several times. Any ideas?

UPDATE: I reinstalled JDK, npm, react-native-cli and android studio. It still gives me the exact same error. Please help.

Answer

Jinkey picture Jinkey · Mar 5, 2019

I fixed this problem with:

chmod 755 android/gradlew 

the chmod command sets the permissions of files or directories. https://www.computerhope.com/unix/uchmod.htm