Spawn cmd.exe Enoent error on running react native project

Viewed 3542

I have made a react native project using react-native init HelloWorld. When I am running this project using react-native run-android , I am getting this error.

events.js:183
  throw er; // Unhandled 'error' event
  ^

Error: spawn cmd.exe ENOENT
at _errnoException (util.js:992:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

On running react-native info

Scanning folders for symlinks in D:\Work\_mine\react- 
       native\HelloWorld\node_modules (37ms)

React Native Environment Info:
System:
  OS: Windows 10
  CPU: x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Memory: 9.10 GB / 15.89 GB
Binaries:
  Yarn: 1.6.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
  Android Studio: AI-173.4907809

I am clueless about problem.

2 Answers

For someone still have the problem after adding environment variable, try this

export PATH="$PATH:/mnt/c/Windows/System32"

+ command (on the same line)

Below solution worked for me.

Your ComSpec environment variable is wrong, replace:

%SystemRoot%\system32\cmd.exe;C:\Windows\System32

With the following:

%SystemRoot%\system32\cmd.exe

Then restart your cmd and retry to generate a project.

Related