- “Error: spawnSync /Users/UserName/Desktop/Path/node_modules/react-native/local-cli/setup_env.sh EACCES”出现以上问题,是当前目录权限问题,详细error如下:
child_process.js:506
throw err;
^
Error: spawnSync /Users/UserName/Desktop/Path/node_modules/react-native/local-cli/setup_env.sh EACCES
at exports._errnoException (util.js:1022:11)
at spawnSync (child_process.js:461:20)
at Object.execFileSync (child_process.js:498:13)
at Object.run (/Users/UserName/Desktop/Path/node_modules/react-native/local-cli/cliEntry.js:156:16)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:117:7)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
解决办法:进入当前目录后,终端执行:
chmod -R 777 node_modules
node_modules是无权限目录。可根据自己未获得权限的目录下进行授权。
- 运行react-native run-android的时候出现“ Could not install the app on the device, read the error above for details”,详细报错如下:
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html。
解决办法:除了可能是模拟器未安装好,或者环境变量配置有问题之外,(如果你之前其它的项目运行时没有问题的),那么可能就是没有权限的问题。只要在项目下运行就是为android文件夹下的gradlew命令 添加权限
chmod 755 android/gradlew
就可以。赶紧尝试一下。
网友评论