Today in the masturbating project, I tried to start a service, but I was given an error, which simply means that my service is already running, and I am not allowed to run the service I want now.

PS: Since my computer is never turned off, I have no idea how many services I run.

At this point, we need to manually shut down the previously enabled service.

Close by process name

  1. Open CMD panel (Window + R) and type CMD to bring up the black window

  2. To check the usage of all ports, run the netstat -ano command

As follows:

Note that the first number is the port to be closed and the last number is used when looking for closure

  1. Find the corresponding port

Suppose we want to turn off port 0.0.0.0:10021

Type the command: tasklist | findstr searches “3952”

3952 is the last number, as shown in the figure, and the corresponding port will be found:

  1. Close port

Enter the taskkill /f /t /im node.exe command

This will close the port, as shown below:

These commands do not only shut down node processes, but can also shut down other processes, such as:



This is the tim.exe process I’m running,

If I want to shut down the process, I just puttaskkill /f /t /im node.exeIn thenode.exeSwitch toTIM.exeWith respect to OK.

Close according to PID

The command above shuts down all Node processes.

Sometimes we don’t want to shut down the entire Node process, but only one process under Node (or another).

For example, if I wanted to shut down 0.0.0.0:10021 and not the other Node processes, I could type taskkill /pid 3952 /f to shut down this process.

Note: Sometimes when we enter this command, we will be prompted that we do not have permissions. In this case, we just need to run CMD as administrator.

& _ &