上运行反应本机项目时

上运行反应本机项目时

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

问题描述

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

I am trying to use react-native run-androidto 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)

我已尝试多次重启我的电脑和模拟器.有什么想法吗?

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.

推荐答案

我解决了这个问题:

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 上运行反应本机项目时 spawnSync ./gradlew EACCES 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 20:34