<p><strong>Windows Machine:</strong></p>
<p>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 <code>node.exe</code>. That would look like this:</p>
<pre><code class="lang-auto">taskkill /im node.exe
</code></pre>
<p>And if the processes still persist, you can force the processes to terminate by adding the <code>/f</code> flag:</p>
<pre><code class="lang-auto">taskkill /f /im node.exe
</code></pre>
<p>If you need more fine-grained control and need to only kill a server that is running on a specific port, you can use <code>netstat</code> to find the process ID, then send a kill signal to it. So in your case, where the port is <code>8080</code>, you could run the following:</p>
<pre><code class="lang-auto">C:>netstat -ano | find "LISTENING" | find "8080"
</code></pre>
<p>The fifth column of the output is the process ID:</p>
<pre><code class="lang-auto"> TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 14828
TCP [::]:8080 [::]:0 LISTENING 14828
</code></pre>
<p>You could then kill the process with <code>taskkill /pid 14828</code>. If the process refuses to exit, then just add the <code>/f</code> (force) parameter to the command.</p>
<p><strong>MacOS machine:</strong></p>
<p>The process is almost identical. You could either kill all Node processes running on the machine:</p>
<pre><code class="lang-auto">killall node
</code></pre>
<p>Or also as alluded to in <a href="https://stackoverflow.com/a/14791025/58">@jacob-groundwater’s answer below</a> using <code>lsof</code>, you can find the PID of a process listening on a port (pass the <code>-i</code> flag and the port to significantly speed this up):</p>
<pre><code class="lang-auto">$ lsof -Pi :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 1073 urname 22u IPv6 bunchanumbershere 0t0 TCP *:8080 (LISTEN)
</code></pre>
<p>The process ID in this case is the number underneath the PID column, which you could then pass to the <code>kill</code> command:</p>
<pre><code class="lang-auto">$ kill 1073
</code></pre>
<p>If the process refuses to exit, then just use the <code>-9</code> flag, which is a <code>SIGTERM</code> and cannot be ignored:</p>
<pre><code class="lang-auto">$ kill -9 1073
</code></pre>
<p><strong>Linux machine:</strong></p>
<p>Again, the process is almost identical. You could either kill all Node processes running on t</p>
<p><em>(Réponse tronquée)</em></p>