7
votes

D:\ReactNative\AwesomeProject>react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 863 file(s) to forward-jetify. Using 4 workers... info Starting JS server... info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... :ReactNative:Cannot run program "npx": CreateProcess error=2, The system cannot find the file specified :ReactNative:Automatic import of native modules failed.

FAILURE: Build failed with an exception.

  • Where: Script 'D:\ReactNative\AwesomeProject\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 169

  • What went wrong: A problem occurred evaluating script.

    Cannot invoke method getErrorStream() on null object

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

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: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • Where: Script 'D:\ReactNative\AwesomeProject\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 169

  • What went wrong: A problem occurred evaluating script.

    Cannot invoke method getErrorStream() on null object

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (D:\ReactNative\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
9
Welcome to Stack Overflow! Please read the help pages, take the SO tour, read about how to ask good questions, as well as this question checklist. Your question consists of error output with no description. Please improve this question by adding an MCVE.Ross Jacobs
the question is completely obviousTheEhsanSarshar
@chandrakant Chaturvedi please review my answer.HolloW

9 Answers

18
votes

For me the problem was over this cli:

@react-native-community/cli-platform-android

The problematic version:

3.0.0-alpha.7

Just run this to install the latest stable release:

npm i @react-native-community/[email protected]

UPDATE 2020:

if this workaround doesn't work now, take a look over this link to use the latest version from the repo, and look the version of your cli to compare and use the correct one:

https://www.npmjs.com/package/@react-native-community/cli-platform-android
5
votes

Had the same problem on linux. All I had to do was just installing npx globally to my machine, that's all.

sudo npm install -g npx

This happens because of lines 155 and 159 in native_modules.gradle:

def command = "${npx} --quiet react-native config"

...

cmdProcess = Runtime.getRuntime().exec(command)

It tries to execute the command but command npx is not found.

2
votes

I have copied and replaced this file from the older project and it did the trick for now.

node_modules@react-native-community\cli-platform-android\native_modules.gradle'

2
votes

For me, I had not closed a tag in my AndroidManifest.xml file.

0
votes

I had same issue and to get it sorted you have downgrade your react-native version or create project with custom react-native version .
react-native init AwesomeProject --version X.XX.X
react-native init myfirstProject --version 0.60.0
(from official react native documentation) .
https://facebook.github.io/react-native/docs/getting-started
Now you can either run it directly from Command line or open Android studio and then open Android folder of react native app in that ( it will sync gradles files and build ).

0
votes

A temporary fix was suggested on github about making changes to your native_modules.gradle file. You need to go to that file location YourProjectDir\node_modules@react-native-community\cli-platform-android\native_modules.gradle and at line 153, change npx --quiet react-native config to npx.cmd --quiet react-native config.

Original answer

0
votes

In Windows

Set environment variable

System Variable > Path > C:\Users\ ankit\ .WebStorm2019.3\config\node\node-v12.13.1-win-x64

0
votes

For solove this preblem first use this command

yarn install

then,

npx react-native start

and ,

npx react-native run-android