ugendrang
ugendrang

Reputation: 281

ReactNative - Error: spawn cmd.exe ENOENT

On executing react-native run-android, got an error message "Error: spawn cmd.exe ENOENT"

Environment:
react: 16.0.0-alpha.6,
react-native: 0.43.1
OS: Windows 10
node.js: 6.9.2
yarn: 0.22.0

c:\sampleproject>react-native start
.....
Running packager on port 8088.
.....

c:\sampleproject>react-native run-android
.....
Installing APK 'app-debug.apk' on 'Nexus_5X_API_23_1(AVD) - 6.0' for 
app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 14.114 secs
Running C:\Users\User\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (C:\Users\User\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 
shell am start -n com.sampleproject/.MainActivity)...
Starting: Intent { cmp=com.sampleproject/.MainActivity }
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn cmd.exe ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

Kindly assist to solve the issue.

Upvotes: 2

Views: 12147

Answers (3)

Sudhanva Patil
Sudhanva Patil

Reputation: 31

Run command 'adb reverse tcp:8081 tcp:8081' in your android sdk platform tools folder.

I think you don't have yarn installed try installing it with chocolatey or something. It should be installed before creating your project (react-native init command).

Edit: In the recent version of react-native they have fixed it. If you want complete freedom from this just uninstall node (For complete uninstallation Completely remove node refer this link) and reinstall node, react-native-cli then create your new project.

Upvotes: 0

MHS
MHS

Reputation: 931

check system environment variables and add C:\windows\system32 in system variables Paths!

Upvotes: 11

ugendrang
ugendrang

Reputation: 281

packager port (8088) and tcp port (8081) are not same. Issue solved when both the ports are same.

Upvotes: 0

Related Questions