orYoffe/create-react-native-web-app

npm run android doesn't work

IanPhilips opened this issue ยท 6 comments

Describe the bug
I can run react native android apps in other projects. With a clean run of your instructions, I can't get the android project to run. I follow the installation instructions, cd into my project and try npm run android, which produces the following message:

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: spawnSync ./gradlew EACCES
    at Object.spawnSync (internal/child_process.js:1002:20)
    at spawnSync (child_process.js:614:24)
    at execFileSync (child_process.js:642:13)
    at runOnAllDevices (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
    at then.result (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! corro@0.1.0 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the corro@0.1.0 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ianphilips/.npm/_logs/2020-04-09T19_41_39_022Z-debug.log

To Reproduce

npx create-react-native-web-app myApp
cd myApp
npm run android

OS
Mac OS v 10.15.3

Expected behavior
The android app should run out of the box

Additional context
If I clone the repo, cd into template, npm install and npm run android this will at least install on the phone though there are some other seemingly unrelated errors.

npm run web does work fine.

I tried opening the android folder in android studio from the stack overflow q but this didn't help.

my .zshrc has the android sdk correctly setup:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

could you check if you have create-react-native-web-app or react-native-cli installed globally ?

create-react-native-web-app -v

react-native -v

hmm I don't have react-native install globally, I always run them with npx. here's the output:
~ npx create-react-native-web-app -V
npx: installed 13 in 1.926s
0.15.1
~ % npx react-native -v
4.6.3

that's odd.. I ran npx react-native-cli -v and got this:
npx: installed 78 in 8.212s
react-native-cli: 2.0.1
react-native: 0.55.4

not sure what version 4.6.3 of react native means.. currently on 0.61 or 0.62

I am also getting the same error message when trying to run on Android. I do not have either create-react-native-web-app or react-native-cli installed globally

npx react-native-cli -v

npx: installed 78 in 5.722s
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory

@IanPhilips @JessicaYeh
Thank you for raising up the issue.
I have just release a patch version 0.15.3
please try again and if it fails run:
npx create-react-native-web-app --version
then output should be: 0.15.3

Many thanks

Thank you for the quick fix! I tried it again on the latest version and npm run android is working now. ๐ŸŽ‰