Daviv Ho
Daviv Ho

Reputation: 61

Angular - Error: spawn cmd ENOENT

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.

Upvotes: 6

Views: 12539

Answers (5)

Sidharth Taneja
Sidharth Taneja

Reputation: 564

There are many guesses on different portal for this error and none of them works. Here is the solution - Run this command to install angular cli before performing anything -

npm install -g @angular/cli

Upvotes: 0

MrMalith
MrMalith

Reputation: 1372

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!

Upvotes: 1

REx
REx

Reputation: 71

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

Upvotes: 3

Daniel Goncalves
Daniel Goncalves

Reputation: 174

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/

Upvotes: 9

Chaya Sandamali
Chaya Sandamali

Reputation: 667

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.

Upvotes: 5

Related Questions