No other process runs on port 3000 except this
Here's the part of a program
const port = process.env.port || 3000;
app.listen((port), () => console.log(`listening to port ${port}`));
const io = require("socket.io")(port) //Here's the problem.
Problem appears when I add port 3000
If I manually write some other port like 4000. It works
Shall I create another port for socket.io?
In case of port 3000
The error looks like this
listening to port 3000
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3000
}
[nodemon] app crashed - waiting for file changes before starting...