6
votes

Hi I have problem when I generate angular - yo angular.

I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.

invoke angular:route invoke angular:controller:C:\Users\david\AppData\Roaming\npm\node_modules\generator-angular\route\index.js create app\scripts\controllers\about.js events.js:85 throw er; // Unhandled 'error' event ^ Error: spawn cmd ENOENT at exports._errnoException (util.js:746:11) at Process.ChildProcess._handle.onexit (child_process.js:1053:32) at child_process.js:1144:20 at process._tickCallback (node.js:355:11)

Anyone show me how to solve this issue? Thanks.

4
what OS are you trying to do this on, and what version of NPM are you using? you haven't provided enough detail for anyone to provide a useful answer.Claies
Hi, I'm using window 7 home edition - 64 bit OS - Cmder terminal - > npm -v 2.14.3 -> bower -v 1.5.2Daviv Ho
Hi I unable to find the solution from How do I debug "Error: spawn ENOENT" on node.jsDaviv Ho

4 Answers

9
votes

Im not sure why this error comes about, however i managed to run my Angular application by running with : ng serve instead of ng serve --open . Please not you will need to copy the url manually and place it in the browser afterwards which should be http://localhost:4200/

5
votes

I got the same issue for windows 8 and tried several installations after doing changes to AppData/Roaming folder. None of the solutions worked for me. The issue is because of an environment variable of your system path is missing . Add "C:\Windows\System32\" value to your system PATH variable.

3
votes

this error occurs when your terminal is not having access to open browers or admin permision try running your terminal as admin

1
votes

I've got this issue after updating Angular CLI to 11.0.2 and I've been spent a lot of time to resolve this,

Apparently, I've tried the default port to serve my project and it served without any errors. which is http://localhost:4200/ but, I needed to run on http://localhost:8000/ So I did this....

First of all try remove node_modules from your directory and re-install npm packages. (I'm saying this because, some users got resolved the issue) to re-install npm packages, run

npm i 

or run below command

npm install

if this didn't work, try adding the port number to the angular.json file.

search for serve options in the json file.

enter image description here

then add your desired port number like this "port": 8000, (P.S. 'WorkspaceUI' means my project name and I've been trying to run on '8000' port. you can run on your own port number.) Then run your project using ng serve command. Thank you!