在模拟器udara上运行react native项目时出现spawnSync ./gradlew EACCES错误 [英] spawnSync ./gradlew EACCES error when running react native project on emulator udara

查看:562
本文介绍了在模拟器udara上运行react native项目时出现spawnSync ./gradlew EACCES错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 react-native运行Android 在Android Studio模拟器上安装我的react-native应用程序. 我已经使用abd-devices检查了模拟器是否可用,并且已经运行了npm-install.

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.

我正在将Ubuntu 18.04与最新版本的android studio和最新的Pixel 2 XL API 28配合使用.

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

我收到以下错误:

spawnSync ./gradlew EACCES

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)

我尝试过几次重新启动PC和仿真器. 有什么想法吗?

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

更新:我重新安装了JDK,npm,react-native-cli和android studio.它仍然给我完全相同的错误.请帮忙.

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

推荐答案

我通过以下方法解决了此问题:

I fixed this problem with:

chmod 755 android/gradlew 

chmod命令设置文件或目录的权限. https://www.computerhope.com/unix/uchmod.htm

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

这篇关于在模拟器udara上运行react native项目时出现spawnSync ./gradlew EACCES错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆