Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'ReactNative:Cannot run program' error

Tags:

react-native

I created a fresh new react native project, when i run the command:

react-native run-android 

I got this message:

yarn run v1.16.0

$ react-native run-android

info JS server already running.

info Installing the app...

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

*:ReactNative:Cannot run program "./node_modules/.bin/react-native" (in directory "C:\Users\yelha\Desktop\rn_project_60\android.."): CreateProcess error=2, The system cannot find the file specified

:ReactNative:Automatic import of native modules failed.*

Configure project :app

*:ReactNative:Cannot run program "./node_modules/.bin/react-native" (in directory "C:\Users\yelha\Desktop\rn_project_60\android.."): CreateProcess error=2, The system cannot find the file specified

:ReactNative:Automatic import of native modules failed.*

Task :app:installDebug

10:19:24 V/ddms: execute: running am get-config

10:19:24 V/ddms: execute 'am get-config' on '5200127cb85a7465' : EOF hit. Read: -1

10:19:24 V/ddms: execute: returning

Installing APK 'app-debug.apk' on 'SM-A520F - 8.0.0' for app:debug

10:19:24 D/app-debug.apk: Uploading app-debug.apk onto device '5200127cb85a7465'

10:19:24 D/Device: Uploading file onto device '5200127cb85a7465'

10:19:24 D/ddms: Reading file permision of C:\Users\yelha\Desktop\rn_project_60\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------

10:19:26 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"

10:20:11 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '5200127cb85a7465' : EOF hit. Read: -1

10:20:11 V/ddms: execute: returning

10:20:11 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"

10:20:11 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '5200127cb85a7465' : EOF hit. Read: -1

10:20:11 V/ddms: execute: returning Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2m 2s 28 actionable tasks: 28 executed info Connecting to the development server... info Starting the app on "5200127cb85a7465"... Starting: Intent { cmp=com.rn_project_60/.MainActivity } Done in 136.52s.

i use versions:

react-native-cli: 2.0.1 react-native: 0.60.0

like image 694
Yacine Avatar asked Jul 03 '19 21:07

Yacine


2 Answers

I just experienced same issue. Here's the solution:

  1. Open another command-line window
  2. Change directory to your React-Native project
  3. Key-in: react-native start

Keep your app open while doing these, good luck!

like image 129
Mr.Blink Avatar answered Nov 10 '22 19:11

Mr.Blink


You must run: react-native init "nameOfProject" --version 0.59.9

like image 1
hdzreyeserick Avatar answered Nov 10 '22 19:11

hdzreyeserick