0

I used to be able to use "create-react-app" without any problems, but then I installed MongoDB and added a PATH of it. Ever since every time I try to create a react app, I get an error.

I tried different solutions: - I cleaned the PATH - I tried a different Node version - I tried installing with "npm install react-scripts@2.1.8"

Nothing works. I don't know if the problem is MongoDB, or the change in the Path.

I use Windows 7.

C:\Users\user\react-apps\mern-todo>npm start

> mern-todo@0.1.0 start C:\Users\user\react-apps\mern-todo
> react-scripts start

Starting the development server...

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

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mern-todo@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mern-todo@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-08-21T19_28_08_965Z-debug.log

C:\Users\user\react-apps\mern-todo>

Here's the complete LOG file:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle mern-todo@0.1.0~prestart: mern-todo@0.1.0
6 info lifecycle mern-todo@0.1.0~start: mern-todo@0.1.0
7 verbose lifecycle mern-todo@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle mern-todo@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\user\react-apps\mern-todo\node_modules\.bin;C:\Program Files\MongoDB\Server\4.2\bin;C:\Program Files (x86)\nodejs\npm.cmd;C:\Program Files\nodejs\;C:\Users\user\AppData\Roaming\npm;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle mern-todo@0.1.0~start: CWD: C:\Users\user\react-apps\mern-todo
10 silly lifecycle mern-todo@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle mern-todo@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle mern-todo@0.1.0~start: Failed to exec start script
13 verbose stack Error: mern-todo@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid mern-todo@0.1.0
15 verbose cwd C:\Users\user\react-apps\mern-todo
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.16.3
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error mern-todo@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the mern-todo@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Do you guys have any idea why is this happening? I'm giving up...

  • The log file for the run may have more information to diagnose the error. You can look in the log file and if it doesn't point at what could be missing in your setup uploaded it as a Paste and share the link here in your question so that other persons can give it another look – Oluwafemi Sule Aug 21 '19 at 19:47
  • Have you looked at this? https://stackoverflow.com/questions/28624686/get-spawn-cmd-enoent-when-try-to-build-cordova-application-event-js85 – Colin Ricardo Aug 21 '19 at 19:59
  • Duplicate [Get 'spawn cmd ENOENT' when try to build Cordova application (event.js:85)](https://stackoverflow.com/questions/28624686/get-spawn-cmd-enoent-when-try-to-build-cordova-application-event-js85) – esqew Oct 20 '22 at 11:28

1 Answers1

1

Have you looked at this? stackoverflow.com/questions/28624686/… – Colin Ricardo

Oh my God, can't believe it was so easy. Adding C:\Windows\System32\ to PATH solved the problem immediately, I must have deleted it when adding Mongo. Thanks!