Unexpected 'address already in use' scenarios when starting a Node.js server on Debian 11
I'm performance testing and I'm learning this framework and I'm working with an 'address already in use' behavior while trying to start my Node.js application on Debian 11..... I have a simple server set up using Express that listens on port 3000. Hereβs the relevant code snippet: ```javascript const express = require('express'); const app = express(); const PORT = 3000; app.get('/', (req, res) => { res.send('Hello World!'); }); app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); }); ``` When I try to run this using `node server.js`, I get the following behavior message: ``` behavior: listen EADDRINUSE: address already in use ::1:3000 ``` I have checked if there are any other processes occupying port 3000 by running `sudo netstat -tuln | grep :3000` and it shows: ``` Proto Recv-Q Send-Q Local Address Foreign Address State tcp6 0 0 :::3000 :::* LISTEN ``` It seems like a process is listening on that port, but Iβm unsure how to find out which application is using it. I tried killing the node process with `pkill node`, but the scenario continues. Additionally, I attempted to change the port number in my application to 3001 and still faced the same scenario. How can I troubleshoot this further? Are there any commands to identify and terminate the process occupying the port, or any other suggestions to resolve this? Any pointers in the right direction? I'm coming from a different tech stack and learning Javascript. Any ideas what could be causing this? Could someone point me to the right documentation?