How can I find what's using a port and free it up without restarting?
#1
I’m trying to set up a local development environment for a web project, and I keep hitting a wall with port conflicts. Every time I run my node server, something else seems to be blocking the port I need, and I’m not sure how to properly identify what’s using it or free it up without restarting my machine.
Reply
#2
I had this last week. I ran sudo lsof -i -P -n | grep LISTEN to see who owned it, got PID 12345, and killed that process. Then I started the server again and it came up in about 2 seconds.
Reply
#3
I found the culprit by running sudo lsof -i :3000 and saw a node process, killed it, and then reran. The port freed up, and the server started fine.
Reply
#4
Maybe the problem isn't the port at all. My watcher kept restarting the app, which looked like a block but was just a crash loop.
Reply
#5
I tried changing the number and saw it bite again; maybe it's the proxy in front of the dev server acting up or a hot reload stubbornly taking sockets.
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: