0

I am a beginner in Angular. Using version 8. I am trying to open my first project using this command in the CLI: ng serve --open. The browser did not open and I got the following error in the console:

chunk {main} main.js, main.js.map (main) 60.6 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 140 kB [initial] [r
endered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 10.1 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 2.97 MB [initial] [rendered]
Date: 2020-02-11T07:41:32.593Z - Hash: 89ab0523139e13e9da30 - Time: 20437ms
** Angular Live Development Server is listening on localhost:4200, open your bro
wser on http://localhost:4200/ **
: Compiled successfully.
events.js:200
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:1
9)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:81:21)←[3
9m
Emitted 'error' event on ChildProcess instance at:
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:1
2)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:81:21)←[3
9m {
  errno: ←[32m'ENOENT'←[39m,
  code: ←[32m'ENOENT'←[39m,
  syscall: ←[32m'spawn cmd'←[39m,
  path: ←[32m'cmd'←[39m,
  spawnargs: [ ←[32m'/s'←[39m, ←[32m'/c'←[39m, ←[32m'start'←[39m, ←[32m'""'←[39m
, ←[32m'/b'←[39m, ←[32m'"http://localhost:4200/"'←[39m ]
}

how could I fix this problem?

Tal Z
  • 3,170
  • 17
  • 30
crazy
  • 1
  • Does this answer your question? [Angular - Error: spawn cmd ENOENT](https://stackoverflow.com/questions/32655955/angular-error-spawn-cmd-enoent) – ruth Feb 11 '20 at 08:18

3 Answers3

0

This might be because of an environment variable of your system path is missing . Add "C:\Windows\System32\" value to your system PATH variable.

Shlok Nangia
  • 2,355
  • 3
  • 16
  • 24
  • where is system path variables? – crazy Feb 11 '20 at 08:37
  • 1. In Search, search for and then select: System (Control Panel) 2. Click the Advanced system settings link. 3. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New. 4. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK. – Shlok Nangia Mar 09 '20 at 06:39
0

Better install the Angular CLI again. There might be some cache issues. Before installing make sure to clean the cache.

npm uninstall -g angular-cli @angular/cli
npm cache clean --force
npm install -g @angular/cli
Ahamed Safnaj
  • 611
  • 1
  • 6
  • 18
0

Had a similar issue. Try running ng serve command without --open.

nashipae
  • 1
  • 1