简体   繁体   中英

Angular : ng serve works but ng serve --open does not

I have recently started with Angular and I am new to it. I have installed nodejs and typescript as well. When i go to my project directory using the command prompt, the ng serve commands works and compiles the project and i need to open the browser manually. However, when i try it with the --open parameter, i am getting an error in the events.js file as:

throw er; // Unhandled 'error' event

ERROR: spawn cmd ENOENT

My versions are:

Angular CLI: 10.0.4 Node: 12.18.3 npm: 6.14.6 OS: win32 x64 tsc: 3.9.7

It seems to be some library inconsistency. Try:

  1. delete node_modules and package-lock.json
  2. run npm update
  3. run npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM