How to kill all instances of a Node.js process via command line ?
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.
Example: Open the folder where we want to start the server.
Start the server and get the list of the same.
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.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!