npm run android doesn't work

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JessicaYehcommented, Apr 11, 2020

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

1reaction
orYoffecommented, Apr 11, 2020

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run android does not launch the Android app
You could try starting the metro bundler, and then just running npm run android (the script from RNN) and then try and open...
Read more >
npx react-native run-android not working #28480 - GitHub
Hi. I am trying to work on an open source project (https://github.com/zulip/zulip-mobile) but when I download the code and run "npx ...
Read more >
create-react-native-web-app - npm
Open dev menu: CMD+D (IOS) / CMD+M (Android); Press "Enable Live-Reload". React native docs - debugging real devices guide · React native ...
Read more >
Troubleshooting - React Native
If you run into issue where executing npm run android on macOS throws the above error, try to run sudo chmod +x android/gradlew...
Read more >
Troubleshooting | React Navigation
Sometimes it might even be due to a corrupt installation. If clearing cache didn't work, try deleting your node_modules folder and run npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found