Error: listen EADDRINUSE: address already in use :::3000 (fixes from similar topics did not resolve)

I have checked the other topics explaining same error, but the fixes do not seem to work for my project. PLEASE HELP! The error details are below:
Connected to MongoDB
node:events:504
throw er; // Unhandled ‘error’ event
^

Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1330:16)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)
at Function.listen (/rbd/pnpm-volume/d3419df4-9f95-4c78-b2ca-78f929adccc5/node_modules/express/lib/application.js:635:24)
at NativeConnection. (/app/server.js:75:9)
at Object.onceWrapper (node:events:645:28)
at NativeConnection.emit (node:events:526:28)
at NativeConnection.Connection.onOpen (/rbd/pnpm-volume/d3419df4-9f95-4c78-b2ca-78f929adccc5/node_modules/mongoose/lib/connection.js:687:8)
at _setClient (/rbd/pnpm-volume/d3419df4-9f95-4c78-b2ca-78f929adccc5/node_modules/mongoose/lib/connection.js:969:8)
at _createMongoClient (/rbd/pnpm-volume/d3419df4-9f95-4c78-b2ca-78f929adccc5/node_modules/mongoose/lib/connection.js:898:3)
Emitted ‘error’ event on Server instance at:
at emitErrorNT (node:net:1357:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: ‘EADDRINUSE’,
errno: -98,
syscall: ‘listen’,
address: ‘::’,
port: 3000
}

If anyone can help me #1 understand what is going wrong (within the context of my project vs. others with same issue on Glitch support), and #2 offer a solution with a few steps and/or example code that would be much appreciated. Thank you!

Try opening project terminal then run pkill -9 node.

Additionally, Try run refresh

Thank you for responding!
Those commands were not working for some reason. I actually ended up asking “ChatGPT” for a bit, and it revealed that to find the process that needs to be “killed” in the Glitch terminal, you must first run:
netstat -lnp | grep :3000
Then I would run:
kill <# of the process needing killed> or kill -9 <# of the process needing killed>
and then run:
refresh
then:
npm start

I also had to change my PORT to NOT include 3000, since this is the default Glitch will run anyway. This seems to have resolved my problem!

In your terminal, You do not need to npm start again. As Glitch will start the project after you do refresh.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.