Skip to content
Related Articles

Related Articles

Improve Article
How to kill all instances of a Node.js process via command line ?
  • Last Updated : 09 Apr, 2021

Node.js is an open-source and cross-platform runtime environment for executing JavaScript code outside the browser. It is widely used in developing APIs and microservices from small to large companies.

Why we need to kill all the instances?

Sometimes there may be some issue with the NodeJS like the server is listening to some other port or there may be some services which you want to run, but it shows an error like service is already running or process is already running. At that time you need to kill all the instances of the NodeJS server at that time. This method will help you to kill all the instances in NodeJS.

Command/CMD: Killings all instances of a NodeJS process via command line.

killall node

Example: Open the folder where we want to start the server.



Start the server and get the list of the same.

npx http-server

Running process: We can see this web-server is running on the NodeJS on the first URL.

Now let’s use the terminate command on the command prompt to see the results.

Here is a success message that the process is terminated.

Let’s open the web-server again. Now we can see at the same URL the process is not running now as the above command has killed all the nodes instances.

So here is an error on the same local address. By using the above command in CMD we can terminate or kill all instance of NodeJS process running.

My Personal Notes arrow_drop_up
Recommended Articles
Page :