how to end ng serve or firebase serve

247,378

Solution 1

You can use the following command to end an ongoing process:

ctrl + c

Solution 2

Try using ctrl + c twice to get the prompt for terminating the batch job.

Solution 3

If you cannot see the "ng serve" command running, then you can do the following on Mac OSX (This should work on any Linux and Uni software as well).

ps -ef | grep "ng serve"

From this, find out the PID of the process and then kill it with the following command.

kill -9 <PID>

Solution 4

I was able to stop via this on Windows for Angular 8:

Step 1: Find 4200 process

netstat -ano | findstr :4200

Step 2: Kill that process:

taskkill /PID <PID> /F

enter image description here

Solution 5

If ctrl + c doesn't work use this:

ctrl +shift+ c

Sometimes people change the behaviour of ctrl + c for copy/pasting so you may need this.

Of course, you should also ensure that the terminal window has keyboard focus, ctrl + c won't work if your browser window has focus.

Share:
247,378
aheigins
Author by

aheigins

Am Currently: a HCI masters student at UCL Would do for Free: Political startups, web technologies, hybrid app development, GOOD UX design/products My personal idea of Hell: Learning about windows or incompatible driver issues.

Updated on June 01, 2021

Comments

  • aheigins
    aheigins almost 3 years

    I've been doing web development with Angular2 and have been using both Angular2 and Firebase to run local servers. I haven't been able to find a command similar to typing quit when using Ionic to create a server, so I have to close the terminal tab each time. Is there a way to end the server and get my terminal tab back?

    Thanks.

  • Shawn de Wet
    Shawn de Wet about 7 years
    I have ng serve running in a console window, and it just is not responding to ctrl+c at all.
  • Muhammad Nadeem
    Muhammad Nadeem about 6 years
    Ctrl+c twice needed
  • André Kool
    André Kool over 5 years
    @Jonathan Please make sure you fix as much as possible when you suggest an edit. In this case make sure the sentence starts with a capital letter and ends with a point for example.
  • Yacino
    Yacino over 5 years
    Thanks you that helped me. If you are on Windows, just open the task manager and kill the node.exe process. Hope this will help
  • kirodge
    kirodge almost 5 years
    taskkill /F /IM node.exe (Careful: this force closes all instances of node.exe on Windows)
  • Sylhare
    Sylhare over 4 years
    Welcome to StackOverFlow you can check the link How To Answer so your answers will help more people
  • Caltor
    Caltor about 4 years
    Seems unnecessarily hard when you can use Ctrl+C ?
  • Caltor
    Caltor about 4 years
    Only relevant if you are running ng serve inside the IDE terminal
  • Caltor
    Caltor about 4 years
    This answer duplicates existing answers and adds nothing new. In fact is also lacks better formatting present in other previous answers.
  • Patrick
    Patrick almost 4 years
    Actually the first time shows the prompt Terminate batch job (Y/N)? and it looks like the second time forces the termination.
  • Vishal Sharma
    Vishal Sharma almost 4 years
    @Caltor when you close that terminal but the server is running it is very much helpful in that scenario
  • Alreadytakenindeed
    Alreadytakenindeed over 3 years
    @Caltor in my case Ctrl+C in the console was just giving me ^C which is totally useless.
  • Adir D
    Adir D over 3 years
    In case of using IntelliJ, pay attention to open the first console u used, ng is still running there, you might have multiple console tabs opened
  • webpreneur
    webpreneur over 3 years
    Did the job for me on Windows 10. Thanks.
  • user1931751
    user1931751 about 3 years
    @ShawndeWet: same here, on Windows 10 with angular 10.x.x; however, it seems to take a minute or 2 to respond. Pressed CTRL+C and 2 minutes later I had the "abort batch process (y/N)" prompt. Edit: pressing ctrl+c multiple times doesn't seem to reduce this time.
  • pixel
    pixel almost 3 years
    that kills terminal, not ng serve command
  • gdubs
    gdubs almost 3 years
    thanks for this. this is what i needed since my app was still running even after shutting down webstorm
  • phancuongviet
    phancuongviet over 2 years
    It worked for me! thanks