stop all instances of node.js server












121















This is my first time working with Node.js and I ran into this problem:



I have started a Node server through the plugin of an IDE. Unfortunately, I cannot use the IDE's terminal. So I tried to run the script from the command line.



This is the problem - I am using the Express module and my app is listening some port (8080). When I start the app from the command line, it throws this error:



events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at Object.<anonymous> (C:xampphtdocsnodechatapp.js:5:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)


Even though I am not very sure what this error could be I assumed that it's because the app is listening on a port which is already in use. So I did:



netstat -an


I can see



TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING


It's because the Node server is already started when I tried to start it from the IDE.



So I want to know, how can I stop all server instances? Also if you can tell me how to detect what's running on a port and kill it.










share|improve this question

























  • Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

    – Kiran Ambati
    Feb 9 '13 at 20:08











  • and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

    – Xiuying Lan
    Dec 27 '17 at 3:09
















121















This is my first time working with Node.js and I ran into this problem:



I have started a Node server through the plugin of an IDE. Unfortunately, I cannot use the IDE's terminal. So I tried to run the script from the command line.



This is the problem - I am using the Express module and my app is listening some port (8080). When I start the app from the command line, it throws this error:



events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at Object.<anonymous> (C:xampphtdocsnodechatapp.js:5:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)


Even though I am not very sure what this error could be I assumed that it's because the app is listening on a port which is already in use. So I did:



netstat -an


I can see



TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING


It's because the Node server is already started when I tried to start it from the IDE.



So I want to know, how can I stop all server instances? Also if you can tell me how to detect what's running on a port and kill it.










share|improve this question

























  • Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

    – Kiran Ambati
    Feb 9 '13 at 20:08











  • and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

    – Xiuying Lan
    Dec 27 '17 at 3:09














121












121








121


68






This is my first time working with Node.js and I ran into this problem:



I have started a Node server through the plugin of an IDE. Unfortunately, I cannot use the IDE's terminal. So I tried to run the script from the command line.



This is the problem - I am using the Express module and my app is listening some port (8080). When I start the app from the command line, it throws this error:



events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at Object.<anonymous> (C:xampphtdocsnodechatapp.js:5:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)


Even though I am not very sure what this error could be I assumed that it's because the app is listening on a port which is already in use. So I did:



netstat -an


I can see



TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING


It's because the Node server is already started when I tried to start it from the IDE.



So I want to know, how can I stop all server instances? Also if you can tell me how to detect what's running on a port and kill it.










share|improve this question
















This is my first time working with Node.js and I ran into this problem:



I have started a Node server through the plugin of an IDE. Unfortunately, I cannot use the IDE's terminal. So I tried to run the script from the command line.



This is the problem - I am using the Express module and my app is listening some port (8080). When I start the app from the command line, it throws this error:



events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at Object.<anonymous> (C:xampphtdocsnodechatapp.js:5:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)


Even though I am not very sure what this error could be I assumed that it's because the app is listening on a port which is already in use. So I did:



netstat -an


I can see



TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING


It's because the Node server is already started when I tried to start it from the IDE.



So I want to know, how can I stop all server instances? Also if you can tell me how to detect what's running on a port and kill it.







javascript windows node.js express port






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 18 '14 at 6:15









hexacyanide

55.6k23126127




55.6k23126127










asked Feb 9 '13 at 19:55









Kiran AmbatiKiran Ambati

1,65441934




1,65441934













  • Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

    – Kiran Ambati
    Feb 9 '13 at 20:08











  • and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

    – Xiuying Lan
    Dec 27 '17 at 3:09



















  • Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

    – Kiran Ambati
    Feb 9 '13 at 20:08











  • and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

    – Xiuying Lan
    Dec 27 '17 at 3:09

















Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

– Kiran Ambati
Feb 9 '13 at 20:08





Sorry I dint mention that I am on windows environment. Please post commands that are relevant. Thanks

– Kiran Ambati
Feb 9 '13 at 20:08













and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

– Xiuying Lan
Dec 27 '17 at 3:09





and also you can find the node.js task in your windows taskmanager. find the progress which name is Node.js:Server-side...and open it's detail info,you will find the pid and detail of your nodejs progress

– Xiuying Lan
Dec 27 '17 at 3:09












13 Answers
13






active

oldest

votes


















286














Windows Machine:



Need to kill a Node.js server, and you don't have any other Node processes running, you can tell your machine to kill all processes named node.exe. That would look like this:



taskkill /im node.exe


And if the processes still persist, you can force the processes to terminate by adding the /f flag:



taskkill /f /im node.exe


If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use netstat to find the process ID, then send a kill signal to it. So in your case, where the port is 8080, you could run the following:



C:>netstat -ano | find "LISTENING" | find "8080"


The fifth column of the output is the process ID:



  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       14828
TCP [::]:8080 [::]:0 LISTENING 14828


You could then kill the process with taskkill /pid 14828. If the process refuses to exit, then just add the /f (force) parameter to the command.





Linux machine:



The process is almost identical. You could either kill all Node processes running on the machine (use -$SIGNAL if SIGKILL is insufficient):



killall node


Or also using netstat, you can find the PID of a process listening on a port:



$ netstat -nlp | grep :8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1073/node


The process ID in this case is the number before the process name in the sixth column, which you could then pass to the kill command:



$ kill 1073


If the process refuses to exit, then just use the -9 flag, which is a SIGTERM and cannot be ignored:



$ kill -9 1073





share|improve this answer





















  • 1





    sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

    – Kiran Ambati
    Feb 9 '13 at 20:00








  • 1





    process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

    – hexacyanide
    Feb 9 '13 at 20:03













  • thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

    – Kiran Ambati
    Feb 9 '13 at 20:10






  • 2





    Try taskkill /IM node.exe. It will kill all processes named node.exe.

    – hexacyanide
    Feb 9 '13 at 20:11






  • 1





    I had to use taskkill /F /IM node.exe to make it work, thanks!

    – Luis
    Nov 20 '13 at 15:35



















58














The fastest way is



killall node


Works with Linux, OS X






share|improve this answer


























  • Easy method but if any other application is running then we have to be more specific.

    – Rajeev Uppala
    Feb 19 at 13:33











  • sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

    – zag2art
    Feb 19 at 14:20



















44














You can use lsof get the process that has bound to the required port.



Unfortunately the flags seem to be different depending on system, but on Mac OS X you can run



lsof -Pi | grep LISTEN


For example, on my machine I get something like:



mongod     8662 jacob    6u  IPv4 0x17ceae4e0970fbe9      0t0  TCP localhost:27017 (LISTEN)
mongod 8662 jacob 7u IPv4 0x17ceae4e0f9c24b1 0t0 TCP localhost:28017 (LISTEN)
memcached 8680 jacob 17u IPv4 0x17ceae4e0971f7d1 0t0 TCP *:11211 (LISTEN)
memcached 8680 jacob 18u IPv6 0x17ceae4e0bdf6479 0t0 TCP *:11211 (LISTEN)
mysqld 9394 jacob 10u IPv4 0x17ceae4e080c4001 0t0 TCP *:3306 (LISTEN)
redis-ser 75429 jacob 4u IPv4 0x17ceae4e1ba8ea59 0t0 TCP localhost:6379 (LISTEN)


The second number is the PID and the port they're listening to is on the right before "(LISTEN)". Find the rogue PID and kill -9 $PID to terminate with extreme prejudice.






share|improve this answer


























  • Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

    – Kiran Ambati
    Feb 9 '13 at 20:11











  • I have no idea how to do it on Windows, sorry Kiran.

    – Jacob Groundwater
    Feb 9 '13 at 20:26











  • no probs! Issue is solved. cheers

    – Kiran Ambati
    Feb 9 '13 at 20:29











  • This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

    – modulitos
    Jun 16 '14 at 20:11



















13














Windows & GitBash Terminal
I needed to use this command inside Windows / Webstorm / GitBash terminal



cmd "/C TASKKILL /IM node.exe /F"





share|improve this answer





















  • 1





    the one that works for me

    – Anna
    Sep 1 '18 at 7:40



















9














if you want to kill a specific process , you can go to command line route:



ps aux | grep node


to get process id and then
do:



kill -9 PID


and if you want to kill all processes then do:



killall -9 node





share|improve this answer































    8














    You can try this:



    taskkill /IM node.exe -F





    share|improve this answer































      2














      You could also try:



      killall nodejs






      share|improve this answer































        0














        Am Using windows Operating system.



        I killed all the node process and restarted the app it worked.



        try



        taskkill /im node.exe





        share|improve this answer































          0














          If you are using windows, follow this:



          1) Open task manager, look for this process: http://prntscr.com/kv3uqx



          2) Then just right click and "End task" it.



          3) That's it, now all the npm commands run form the start.



          Hope it help somebody!



          Cheers






          share|improve this answer































            0














            Use the following command to kill and restart node server from batch file



                @echo off
            cd "D:samProjectsNode"
            taskkill /IM node.exe -F
            start /min cmd /C "node index.js"
            goto :EOF





            share|improve this answer































              0














              Multiplatform, stable, best solution:



              use fkill to kill process which is taking your port:



              fkill -f :8080


              To install fkill use command: npm i -g fkill






              share|improve this answer































                -1














                in windows command
                Type command blow:



                taskkill /f /im node.exe






                share|improve this answer































                  -2














                  Press in cmd or bash :
                  Ctrl + C






                  share|improve this answer






















                    protected by l'L'l Feb 5 at 7:07



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?














                    13 Answers
                    13






                    active

                    oldest

                    votes








                    13 Answers
                    13






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    286














                    Windows Machine:



                    Need to kill a Node.js server, and you don't have any other Node processes running, you can tell your machine to kill all processes named node.exe. That would look like this:



                    taskkill /im node.exe


                    And if the processes still persist, you can force the processes to terminate by adding the /f flag:



                    taskkill /f /im node.exe


                    If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use netstat to find the process ID, then send a kill signal to it. So in your case, where the port is 8080, you could run the following:



                    C:>netstat -ano | find "LISTENING" | find "8080"


                    The fifth column of the output is the process ID:



                      TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       14828
                    TCP [::]:8080 [::]:0 LISTENING 14828


                    You could then kill the process with taskkill /pid 14828. If the process refuses to exit, then just add the /f (force) parameter to the command.





                    Linux machine:



                    The process is almost identical. You could either kill all Node processes running on the machine (use -$SIGNAL if SIGKILL is insufficient):



                    killall node


                    Or also using netstat, you can find the PID of a process listening on a port:



                    $ netstat -nlp | grep :8080
                    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1073/node


                    The process ID in this case is the number before the process name in the sixth column, which you could then pass to the kill command:



                    $ kill 1073


                    If the process refuses to exit, then just use the -9 flag, which is a SIGTERM and cannot be ignored:



                    $ kill -9 1073





                    share|improve this answer





















                    • 1





                      sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:00








                    • 1





                      process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                      – hexacyanide
                      Feb 9 '13 at 20:03













                    • thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                      – Kiran Ambati
                      Feb 9 '13 at 20:10






                    • 2





                      Try taskkill /IM node.exe. It will kill all processes named node.exe.

                      – hexacyanide
                      Feb 9 '13 at 20:11






                    • 1





                      I had to use taskkill /F /IM node.exe to make it work, thanks!

                      – Luis
                      Nov 20 '13 at 15:35
















                    286














                    Windows Machine:



                    Need to kill a Node.js server, and you don't have any other Node processes running, you can tell your machine to kill all processes named node.exe. That would look like this:



                    taskkill /im node.exe


                    And if the processes still persist, you can force the processes to terminate by adding the /f flag:



                    taskkill /f /im node.exe


                    If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use netstat to find the process ID, then send a kill signal to it. So in your case, where the port is 8080, you could run the following:



                    C:>netstat -ano | find "LISTENING" | find "8080"


                    The fifth column of the output is the process ID:



                      TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       14828
                    TCP [::]:8080 [::]:0 LISTENING 14828


                    You could then kill the process with taskkill /pid 14828. If the process refuses to exit, then just add the /f (force) parameter to the command.





                    Linux machine:



                    The process is almost identical. You could either kill all Node processes running on the machine (use -$SIGNAL if SIGKILL is insufficient):



                    killall node


                    Or also using netstat, you can find the PID of a process listening on a port:



                    $ netstat -nlp | grep :8080
                    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1073/node


                    The process ID in this case is the number before the process name in the sixth column, which you could then pass to the kill command:



                    $ kill 1073


                    If the process refuses to exit, then just use the -9 flag, which is a SIGTERM and cannot be ignored:



                    $ kill -9 1073





                    share|improve this answer





















                    • 1





                      sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:00








                    • 1





                      process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                      – hexacyanide
                      Feb 9 '13 at 20:03













                    • thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                      – Kiran Ambati
                      Feb 9 '13 at 20:10






                    • 2





                      Try taskkill /IM node.exe. It will kill all processes named node.exe.

                      – hexacyanide
                      Feb 9 '13 at 20:11






                    • 1





                      I had to use taskkill /F /IM node.exe to make it work, thanks!

                      – Luis
                      Nov 20 '13 at 15:35














                    286












                    286








                    286







                    Windows Machine:



                    Need to kill a Node.js server, and you don't have any other Node processes running, you can tell your machine to kill all processes named node.exe. That would look like this:



                    taskkill /im node.exe


                    And if the processes still persist, you can force the processes to terminate by adding the /f flag:



                    taskkill /f /im node.exe


                    If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use netstat to find the process ID, then send a kill signal to it. So in your case, where the port is 8080, you could run the following:



                    C:>netstat -ano | find "LISTENING" | find "8080"


                    The fifth column of the output is the process ID:



                      TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       14828
                    TCP [::]:8080 [::]:0 LISTENING 14828


                    You could then kill the process with taskkill /pid 14828. If the process refuses to exit, then just add the /f (force) parameter to the command.





                    Linux machine:



                    The process is almost identical. You could either kill all Node processes running on the machine (use -$SIGNAL if SIGKILL is insufficient):



                    killall node


                    Or also using netstat, you can find the PID of a process listening on a port:



                    $ netstat -nlp | grep :8080
                    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1073/node


                    The process ID in this case is the number before the process name in the sixth column, which you could then pass to the kill command:



                    $ kill 1073


                    If the process refuses to exit, then just use the -9 flag, which is a SIGTERM and cannot be ignored:



                    $ kill -9 1073





                    share|improve this answer















                    Windows Machine:



                    Need to kill a Node.js server, and you don't have any other Node processes running, you can tell your machine to kill all processes named node.exe. That would look like this:



                    taskkill /im node.exe


                    And if the processes still persist, you can force the processes to terminate by adding the /f flag:



                    taskkill /f /im node.exe


                    If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use netstat to find the process ID, then send a kill signal to it. So in your case, where the port is 8080, you could run the following:



                    C:>netstat -ano | find "LISTENING" | find "8080"


                    The fifth column of the output is the process ID:



                      TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       14828
                    TCP [::]:8080 [::]:0 LISTENING 14828


                    You could then kill the process with taskkill /pid 14828. If the process refuses to exit, then just add the /f (force) parameter to the command.





                    Linux machine:



                    The process is almost identical. You could either kill all Node processes running on the machine (use -$SIGNAL if SIGKILL is insufficient):



                    killall node


                    Or also using netstat, you can find the PID of a process listening on a port:



                    $ netstat -nlp | grep :8080
                    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1073/node


                    The process ID in this case is the number before the process name in the sixth column, which you could then pass to the kill command:



                    $ kill 1073


                    If the process refuses to exit, then just use the -9 flag, which is a SIGTERM and cannot be ignored:



                    $ kill -9 1073






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jul 25 '17 at 16:20









                    chris Frisina

                    12k1761130




                    12k1761130










                    answered Feb 9 '13 at 19:56









                    hexacyanidehexacyanide

                    55.6k23126127




                    55.6k23126127








                    • 1





                      sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:00








                    • 1





                      process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                      – hexacyanide
                      Feb 9 '13 at 20:03













                    • thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                      – Kiran Ambati
                      Feb 9 '13 at 20:10






                    • 2





                      Try taskkill /IM node.exe. It will kill all processes named node.exe.

                      – hexacyanide
                      Feb 9 '13 at 20:11






                    • 1





                      I had to use taskkill /F /IM node.exe to make it work, thanks!

                      – Luis
                      Nov 20 '13 at 15:35














                    • 1





                      sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:00








                    • 1





                      process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                      – hexacyanide
                      Feb 9 '13 at 20:03













                    • thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                      – Kiran Ambati
                      Feb 9 '13 at 20:10






                    • 2





                      Try taskkill /IM node.exe. It will kill all processes named node.exe.

                      – hexacyanide
                      Feb 9 '13 at 20:11






                    • 1





                      I had to use taskkill /F /IM node.exe to make it work, thanks!

                      – Luis
                      Nov 20 '13 at 15:35








                    1




                    1





                    sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                    – Kiran Ambati
                    Feb 9 '13 at 20:00







                    sorry , How exactly I can use these commands? process.exit() might be in code? but server is already started. It is likely that it is started with command node app.js but not node-dev app.js. And "node killall" is not working. Am I doing it wrong? Thank you

                    – Kiran Ambati
                    Feb 9 '13 at 20:00






                    1




                    1





                    process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                    – hexacyanide
                    Feb 9 '13 at 20:03







                    process.exit() in your application causes the NodeJS instance to close. killall node in bash would kill all NodeJS instances running on your machine.

                    – hexacyanide
                    Feb 9 '13 at 20:03















                    thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                    – Kiran Ambati
                    Feb 9 '13 at 20:10





                    thanks @hexacyanide . I am developing on windows. Does that make killall node an invalid command because I cannot use it from command line.

                    – Kiran Ambati
                    Feb 9 '13 at 20:10




                    2




                    2





                    Try taskkill /IM node.exe. It will kill all processes named node.exe.

                    – hexacyanide
                    Feb 9 '13 at 20:11





                    Try taskkill /IM node.exe. It will kill all processes named node.exe.

                    – hexacyanide
                    Feb 9 '13 at 20:11




                    1




                    1





                    I had to use taskkill /F /IM node.exe to make it work, thanks!

                    – Luis
                    Nov 20 '13 at 15:35





                    I had to use taskkill /F /IM node.exe to make it work, thanks!

                    – Luis
                    Nov 20 '13 at 15:35













                    58














                    The fastest way is



                    killall node


                    Works with Linux, OS X






                    share|improve this answer


























                    • Easy method but if any other application is running then we have to be more specific.

                      – Rajeev Uppala
                      Feb 19 at 13:33











                    • sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                      – zag2art
                      Feb 19 at 14:20
















                    58














                    The fastest way is



                    killall node


                    Works with Linux, OS X






                    share|improve this answer


























                    • Easy method but if any other application is running then we have to be more specific.

                      – Rajeev Uppala
                      Feb 19 at 13:33











                    • sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                      – zag2art
                      Feb 19 at 14:20














                    58












                    58








                    58







                    The fastest way is



                    killall node


                    Works with Linux, OS X






                    share|improve this answer















                    The fastest way is



                    killall node


                    Works with Linux, OS X







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 6 '17 at 15:01

























                    answered Oct 1 '15 at 12:15









                    zag2artzag2art

                    2,8121930




                    2,8121930













                    • Easy method but if any other application is running then we have to be more specific.

                      – Rajeev Uppala
                      Feb 19 at 13:33











                    • sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                      – zag2art
                      Feb 19 at 14:20



















                    • Easy method but if any other application is running then we have to be more specific.

                      – Rajeev Uppala
                      Feb 19 at 13:33











                    • sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                      – zag2art
                      Feb 19 at 14:20

















                    Easy method but if any other application is running then we have to be more specific.

                    – Rajeev Uppala
                    Feb 19 at 13:33





                    Easy method but if any other application is running then we have to be more specific.

                    – Rajeev Uppala
                    Feb 19 at 13:33













                    sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                    – zag2art
                    Feb 19 at 14:20





                    sure, but the question was "stop all instances of node.js server", so, it's relevant, I think

                    – zag2art
                    Feb 19 at 14:20











                    44














                    You can use lsof get the process that has bound to the required port.



                    Unfortunately the flags seem to be different depending on system, but on Mac OS X you can run



                    lsof -Pi | grep LISTEN


                    For example, on my machine I get something like:



                    mongod     8662 jacob    6u  IPv4 0x17ceae4e0970fbe9      0t0  TCP localhost:27017 (LISTEN)
                    mongod 8662 jacob 7u IPv4 0x17ceae4e0f9c24b1 0t0 TCP localhost:28017 (LISTEN)
                    memcached 8680 jacob 17u IPv4 0x17ceae4e0971f7d1 0t0 TCP *:11211 (LISTEN)
                    memcached 8680 jacob 18u IPv6 0x17ceae4e0bdf6479 0t0 TCP *:11211 (LISTEN)
                    mysqld 9394 jacob 10u IPv4 0x17ceae4e080c4001 0t0 TCP *:3306 (LISTEN)
                    redis-ser 75429 jacob 4u IPv4 0x17ceae4e1ba8ea59 0t0 TCP localhost:6379 (LISTEN)


                    The second number is the PID and the port they're listening to is on the right before "(LISTEN)". Find the rogue PID and kill -9 $PID to terminate with extreme prejudice.






                    share|improve this answer


























                    • Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:11











                    • I have no idea how to do it on Windows, sorry Kiran.

                      – Jacob Groundwater
                      Feb 9 '13 at 20:26











                    • no probs! Issue is solved. cheers

                      – Kiran Ambati
                      Feb 9 '13 at 20:29











                    • This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                      – modulitos
                      Jun 16 '14 at 20:11
















                    44














                    You can use lsof get the process that has bound to the required port.



                    Unfortunately the flags seem to be different depending on system, but on Mac OS X you can run



                    lsof -Pi | grep LISTEN


                    For example, on my machine I get something like:



                    mongod     8662 jacob    6u  IPv4 0x17ceae4e0970fbe9      0t0  TCP localhost:27017 (LISTEN)
                    mongod 8662 jacob 7u IPv4 0x17ceae4e0f9c24b1 0t0 TCP localhost:28017 (LISTEN)
                    memcached 8680 jacob 17u IPv4 0x17ceae4e0971f7d1 0t0 TCP *:11211 (LISTEN)
                    memcached 8680 jacob 18u IPv6 0x17ceae4e0bdf6479 0t0 TCP *:11211 (LISTEN)
                    mysqld 9394 jacob 10u IPv4 0x17ceae4e080c4001 0t0 TCP *:3306 (LISTEN)
                    redis-ser 75429 jacob 4u IPv4 0x17ceae4e1ba8ea59 0t0 TCP localhost:6379 (LISTEN)


                    The second number is the PID and the port they're listening to is on the right before "(LISTEN)". Find the rogue PID and kill -9 $PID to terminate with extreme prejudice.






                    share|improve this answer


























                    • Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:11











                    • I have no idea how to do it on Windows, sorry Kiran.

                      – Jacob Groundwater
                      Feb 9 '13 at 20:26











                    • no probs! Issue is solved. cheers

                      – Kiran Ambati
                      Feb 9 '13 at 20:29











                    • This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                      – modulitos
                      Jun 16 '14 at 20:11














                    44












                    44








                    44







                    You can use lsof get the process that has bound to the required port.



                    Unfortunately the flags seem to be different depending on system, but on Mac OS X you can run



                    lsof -Pi | grep LISTEN


                    For example, on my machine I get something like:



                    mongod     8662 jacob    6u  IPv4 0x17ceae4e0970fbe9      0t0  TCP localhost:27017 (LISTEN)
                    mongod 8662 jacob 7u IPv4 0x17ceae4e0f9c24b1 0t0 TCP localhost:28017 (LISTEN)
                    memcached 8680 jacob 17u IPv4 0x17ceae4e0971f7d1 0t0 TCP *:11211 (LISTEN)
                    memcached 8680 jacob 18u IPv6 0x17ceae4e0bdf6479 0t0 TCP *:11211 (LISTEN)
                    mysqld 9394 jacob 10u IPv4 0x17ceae4e080c4001 0t0 TCP *:3306 (LISTEN)
                    redis-ser 75429 jacob 4u IPv4 0x17ceae4e1ba8ea59 0t0 TCP localhost:6379 (LISTEN)


                    The second number is the PID and the port they're listening to is on the right before "(LISTEN)". Find the rogue PID and kill -9 $PID to terminate with extreme prejudice.






                    share|improve this answer















                    You can use lsof get the process that has bound to the required port.



                    Unfortunately the flags seem to be different depending on system, but on Mac OS X you can run



                    lsof -Pi | grep LISTEN


                    For example, on my machine I get something like:



                    mongod     8662 jacob    6u  IPv4 0x17ceae4e0970fbe9      0t0  TCP localhost:27017 (LISTEN)
                    mongod 8662 jacob 7u IPv4 0x17ceae4e0f9c24b1 0t0 TCP localhost:28017 (LISTEN)
                    memcached 8680 jacob 17u IPv4 0x17ceae4e0971f7d1 0t0 TCP *:11211 (LISTEN)
                    memcached 8680 jacob 18u IPv6 0x17ceae4e0bdf6479 0t0 TCP *:11211 (LISTEN)
                    mysqld 9394 jacob 10u IPv4 0x17ceae4e080c4001 0t0 TCP *:3306 (LISTEN)
                    redis-ser 75429 jacob 4u IPv4 0x17ceae4e1ba8ea59 0t0 TCP localhost:6379 (LISTEN)


                    The second number is the PID and the port they're listening to is on the right before "(LISTEN)". Find the rogue PID and kill -9 $PID to terminate with extreme prejudice.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 17 '14 at 11:29









                    Dave Liepmann

                    1,14611319




                    1,14611319










                    answered Feb 9 '13 at 20:07









                    Jacob GroundwaterJacob Groundwater

                    4,85412240




                    4,85412240













                    • Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:11











                    • I have no idea how to do it on Windows, sorry Kiran.

                      – Jacob Groundwater
                      Feb 9 '13 at 20:26











                    • no probs! Issue is solved. cheers

                      – Kiran Ambati
                      Feb 9 '13 at 20:29











                    • This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                      – modulitos
                      Jun 16 '14 at 20:11



















                    • Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                      – Kiran Ambati
                      Feb 9 '13 at 20:11











                    • I have no idea how to do it on Windows, sorry Kiran.

                      – Jacob Groundwater
                      Feb 9 '13 at 20:26











                    • no probs! Issue is solved. cheers

                      – Kiran Ambati
                      Feb 9 '13 at 20:29











                    • This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                      – modulitos
                      Jun 16 '14 at 20:11

















                    Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                    – Kiran Ambati
                    Feb 9 '13 at 20:11





                    Hi Jacob , please can you edit answer and add windows version because I am developing on windows. Thank you

                    – Kiran Ambati
                    Feb 9 '13 at 20:11













                    I have no idea how to do it on Windows, sorry Kiran.

                    – Jacob Groundwater
                    Feb 9 '13 at 20:26





                    I have no idea how to do it on Windows, sorry Kiran.

                    – Jacob Groundwater
                    Feb 9 '13 at 20:26













                    no probs! Issue is solved. cheers

                    – Kiran Ambati
                    Feb 9 '13 at 20:29





                    no probs! Issue is solved. cheers

                    – Kiran Ambati
                    Feb 9 '13 at 20:29













                    This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                    – modulitos
                    Jun 16 '14 at 20:11





                    This is a great answer, especially when there are multiple node servers running on different ports. I can easily distinguish the process ID's running on each port.

                    – modulitos
                    Jun 16 '14 at 20:11











                    13














                    Windows & GitBash Terminal
                    I needed to use this command inside Windows / Webstorm / GitBash terminal



                    cmd "/C TASKKILL /IM node.exe /F"





                    share|improve this answer





















                    • 1





                      the one that works for me

                      – Anna
                      Sep 1 '18 at 7:40
















                    13














                    Windows & GitBash Terminal
                    I needed to use this command inside Windows / Webstorm / GitBash terminal



                    cmd "/C TASKKILL /IM node.exe /F"





                    share|improve this answer





















                    • 1





                      the one that works for me

                      – Anna
                      Sep 1 '18 at 7:40














                    13












                    13








                    13







                    Windows & GitBash Terminal
                    I needed to use this command inside Windows / Webstorm / GitBash terminal



                    cmd "/C TASKKILL /IM node.exe /F"





                    share|improve this answer















                    Windows & GitBash Terminal
                    I needed to use this command inside Windows / Webstorm / GitBash terminal



                    cmd "/C TASKKILL /IM node.exe /F"






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 19 '18 at 12:24

























                    answered Sep 22 '17 at 21:17









                    EnkodeEnkode

                    2,72422239




                    2,72422239








                    • 1





                      the one that works for me

                      – Anna
                      Sep 1 '18 at 7:40














                    • 1





                      the one that works for me

                      – Anna
                      Sep 1 '18 at 7:40








                    1




                    1





                    the one that works for me

                    – Anna
                    Sep 1 '18 at 7:40





                    the one that works for me

                    – Anna
                    Sep 1 '18 at 7:40











                    9














                    if you want to kill a specific process , you can go to command line route:



                    ps aux | grep node


                    to get process id and then
                    do:



                    kill -9 PID


                    and if you want to kill all processes then do:



                    killall -9 node





                    share|improve this answer




























                      9














                      if you want to kill a specific process , you can go to command line route:



                      ps aux | grep node


                      to get process id and then
                      do:



                      kill -9 PID


                      and if you want to kill all processes then do:



                      killall -9 node





                      share|improve this answer


























                        9












                        9








                        9







                        if you want to kill a specific process , you can go to command line route:



                        ps aux | grep node


                        to get process id and then
                        do:



                        kill -9 PID


                        and if you want to kill all processes then do:



                        killall -9 node





                        share|improve this answer













                        if you want to kill a specific process , you can go to command line route:



                        ps aux | grep node


                        to get process id and then
                        do:



                        kill -9 PID


                        and if you want to kill all processes then do:



                        killall -9 node






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jun 3 '18 at 6:38









                        Ali_HrAli_Hr

                        18119




                        18119























                            8














                            You can try this:



                            taskkill /IM node.exe -F





                            share|improve this answer




























                              8














                              You can try this:



                              taskkill /IM node.exe -F





                              share|improve this answer


























                                8












                                8








                                8







                                You can try this:



                                taskkill /IM node.exe -F





                                share|improve this answer













                                You can try this:



                                taskkill /IM node.exe -F






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Jan 28 '14 at 13:35







                                user1796855






























                                    2














                                    You could also try:



                                    killall nodejs






                                    share|improve this answer




























                                      2














                                      You could also try:



                                      killall nodejs






                                      share|improve this answer


























                                        2












                                        2








                                        2







                                        You could also try:



                                        killall nodejs






                                        share|improve this answer













                                        You could also try:



                                        killall nodejs







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jan 4 '17 at 14:11









                                        DigitlimitDigitlimit

                                        10.1k44671




                                        10.1k44671























                                            0














                                            Am Using windows Operating system.



                                            I killed all the node process and restarted the app it worked.



                                            try



                                            taskkill /im node.exe





                                            share|improve this answer




























                                              0














                                              Am Using windows Operating system.



                                              I killed all the node process and restarted the app it worked.



                                              try



                                              taskkill /im node.exe





                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                Am Using windows Operating system.



                                                I killed all the node process and restarted the app it worked.



                                                try



                                                taskkill /im node.exe





                                                share|improve this answer













                                                Am Using windows Operating system.



                                                I killed all the node process and restarted the app it worked.



                                                try



                                                taskkill /im node.exe






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jun 21 '17 at 11:54









                                                Sathya BamanSathya Baman

                                                1,46922354




                                                1,46922354























                                                    0














                                                    If you are using windows, follow this:



                                                    1) Open task manager, look for this process: http://prntscr.com/kv3uqx



                                                    2) Then just right click and "End task" it.



                                                    3) That's it, now all the npm commands run form the start.



                                                    Hope it help somebody!



                                                    Cheers






                                                    share|improve this answer




























                                                      0














                                                      If you are using windows, follow this:



                                                      1) Open task manager, look for this process: http://prntscr.com/kv3uqx



                                                      2) Then just right click and "End task" it.



                                                      3) That's it, now all the npm commands run form the start.



                                                      Hope it help somebody!



                                                      Cheers






                                                      share|improve this answer


























                                                        0












                                                        0








                                                        0







                                                        If you are using windows, follow this:



                                                        1) Open task manager, look for this process: http://prntscr.com/kv3uqx



                                                        2) Then just right click and "End task" it.



                                                        3) That's it, now all the npm commands run form the start.



                                                        Hope it help somebody!



                                                        Cheers






                                                        share|improve this answer













                                                        If you are using windows, follow this:



                                                        1) Open task manager, look for this process: http://prntscr.com/kv3uqx



                                                        2) Then just right click and "End task" it.



                                                        3) That's it, now all the npm commands run form the start.



                                                        Hope it help somebody!



                                                        Cheers







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Sep 16 '18 at 19:07









                                                        Neil BannetNeil Bannet

                                                        6517




                                                        6517























                                                            0














                                                            Use the following command to kill and restart node server from batch file



                                                                @echo off
                                                            cd "D:samProjectsNode"
                                                            taskkill /IM node.exe -F
                                                            start /min cmd /C "node index.js"
                                                            goto :EOF





                                                            share|improve this answer




























                                                              0














                                                              Use the following command to kill and restart node server from batch file



                                                                  @echo off
                                                              cd "D:samProjectsNode"
                                                              taskkill /IM node.exe -F
                                                              start /min cmd /C "node index.js"
                                                              goto :EOF





                                                              share|improve this answer


























                                                                0












                                                                0








                                                                0







                                                                Use the following command to kill and restart node server from batch file



                                                                    @echo off
                                                                cd "D:samProjectsNode"
                                                                taskkill /IM node.exe -F
                                                                start /min cmd /C "node index.js"
                                                                goto :EOF





                                                                share|improve this answer













                                                                Use the following command to kill and restart node server from batch file



                                                                    @echo off
                                                                cd "D:samProjectsNode"
                                                                taskkill /IM node.exe -F
                                                                start /min cmd /C "node index.js"
                                                                goto :EOF






                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Oct 1 '18 at 13:18









                                                                Samadhan VirkarSamadhan Virkar

                                                                12




                                                                12























                                                                    0














                                                                    Multiplatform, stable, best solution:



                                                                    use fkill to kill process which is taking your port:



                                                                    fkill -f :8080


                                                                    To install fkill use command: npm i -g fkill






                                                                    share|improve this answer




























                                                                      0














                                                                      Multiplatform, stable, best solution:



                                                                      use fkill to kill process which is taking your port:



                                                                      fkill -f :8080


                                                                      To install fkill use command: npm i -g fkill






                                                                      share|improve this answer


























                                                                        0












                                                                        0








                                                                        0







                                                                        Multiplatform, stable, best solution:



                                                                        use fkill to kill process which is taking your port:



                                                                        fkill -f :8080


                                                                        To install fkill use command: npm i -g fkill






                                                                        share|improve this answer













                                                                        Multiplatform, stable, best solution:



                                                                        use fkill to kill process which is taking your port:



                                                                        fkill -f :8080


                                                                        To install fkill use command: npm i -g fkill







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered Jan 16 at 0:01









                                                                        Dariusz FilipiakDariusz Filipiak

                                                                        91531126




                                                                        91531126























                                                                            -1














                                                                            in windows command
                                                                            Type command blow:



                                                                            taskkill /f /im node.exe






                                                                            share|improve this answer




























                                                                              -1














                                                                              in windows command
                                                                              Type command blow:



                                                                              taskkill /f /im node.exe






                                                                              share|improve this answer


























                                                                                -1












                                                                                -1








                                                                                -1







                                                                                in windows command
                                                                                Type command blow:



                                                                                taskkill /f /im node.exe






                                                                                share|improve this answer













                                                                                in windows command
                                                                                Type command blow:



                                                                                taskkill /f /im node.exe







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Jan 7 at 7:09









                                                                                Hossein KohzadiHossein Kohzadi

                                                                                214




                                                                                214























                                                                                    -2














                                                                                    Press in cmd or bash :
                                                                                    Ctrl + C






                                                                                    share|improve this answer




























                                                                                      -2














                                                                                      Press in cmd or bash :
                                                                                      Ctrl + C






                                                                                      share|improve this answer


























                                                                                        -2












                                                                                        -2








                                                                                        -2







                                                                                        Press in cmd or bash :
                                                                                        Ctrl + C






                                                                                        share|improve this answer













                                                                                        Press in cmd or bash :
                                                                                        Ctrl + C







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered Nov 24 '17 at 6:47









                                                                                        Altynbek S.Altynbek S.

                                                                                        1




                                                                                        1

















                                                                                            protected by l'L'l Feb 5 at 7:07



                                                                                            Thank you for your interest in this question.
                                                                                            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                                            Would you like to answer one of these unanswered questions instead?



                                                                                            Popular posts from this blog

                                                                                            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                                                                            Alcedinidae

                                                                                            RAC Tourist Trophy