npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

On running command "ng serve --open" after successfull compile it shows an error

C:\Users\14pra\Desktop\Angular\Scribe>ng serve --open

Date: 2019-07-31T12:06:29.429Z
Hash: 913f7fba9c8b80d02019
Time: 16852ms
chunk {main} main.js, main.js.map (main) 89 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 248 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 143 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.22 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 6.69 MB [initial] [rendered]
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.
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)


(You might get an answer here, but because this forum is focused on npm, you might want to ask your question somewhere that targets experts with your package. I have moved your topic to #community:javascript)


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


When researching the issue it sounds like most of those who encounter this are using Yarn, but I’m still having this issue despite using NPM. The main difference is that I don’t receive an “angular development server is listening on localhost:4200, open your browser on siteLocationName.”

chunk {main} main.js, main.js.map (main) 615 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 237 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 93.3 kB [entry] [rendered]
chunk {styles} styles.css, styles.css.map (styles) 1.55 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 8.82 MB [initial] [rendered]
i 「wdm」: Compiled successfully.
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! SolutionName@SolutionVersion start: ng serve --o --base-href /SolutionName/ --proxy-config proxy.conf.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SolutionName@SolutionVersion 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\MyAwesomePath\LookHowCoolItIs\ThisPathOfMine\npm-cache_logs\2019-08-05T10_31_57_962Z-debug.log


I managed to solve this in the interim by adjusting my postbuild steps (previously ng serve --o & additional logic – now ng serve & additional logic). Sounds very simple, but removing the --o solved my issue!