Tag Archives: spawn CMD enoent error

Start failure: spawn CMD enoent error (How to Fix)

When the front-end project used the NPM tool Live-Server to handle the hot update of the page, an error message was reported as follows:

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! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\asus\AppData\Roaming\npm-cache\_logs\2019-09-03T13_39_22_260Z-debug.log

Solutions:
Find PATH in the environment variable and add %SystemRoot%\system32 at the end; Notice the semicolon


Restart the computer after adding it will take effect!
Why live- Server?
Local development often requires building temporary services. Http-server is the first thing that comes to mind, but it is popular to modify the file browser to automatically flush the hot Socketing (such as Live-Reload), but if you want your browser to automatically open your project, use Opener.
Live-server implements all of the functionality of the three plug-ins, and it’s easy to launch a professional-looking local service, so choose Live-Server.
Command for Live-Server:
Installation:

npm  install -g live-server

Start the project by specifying the port number:

live-server --port=port number