Search code examples
node.jsangularwindowsreact-nativeenoent

Facing Issue in Creating/Setting up React Native Project on System


Below are the errors which I am facing. Any help would be really appreciated. If anything else needed from my side please let me know.

C:\Users\manikthakur\Desktop>create-react-native-app MyReactNative
This command requires Expo CLI.
Do you want to install it globally [Y/n]? Y
Installing the package 'expo-cli'...
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Windows\system32\cmd.exe;C:\Windows\System32 ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at ChildProcess.cp.emit (C:\Users\manikthakur\AppData\Roaming\npm\node_modul
es\create-react-native-app\node_modules\cross-spawn\lib\enoent.js:40:29)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Solution

  • Finally, it worked now for me. Below is the solution which worked for the above issue.

    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.