Cannot run program "node" react native

react-native 在Android Studio打开后,build过程出错,

出错位置在 setting.gradle 文件中,内容如下

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
useExpoModules()

解决办法:

sudo chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv

参考链接:https://github.com/react-native-community/cli/issues/1457

展示评论