How stop running server on local host 5000?

Hi friends,

I am doing the freeCodeCamp tutorial on creating a fullstack app using MongoDB. I’m not sure how to stop the server from running on a port. I have to restart my computer every time I want to restart my app.

Thanks in advance : )

On your terminal, you can stop the process by clicking CTRL + C

Thanks but that doesns’t seem to work. After clicking cntrl + c, when I try to restart the server in the terminal with: nodemon server
I get an error - something like Error : ENOENT
and it says something like “port already in use”.

The only way I have found to fix this is to restart my computer.

Hi there,

You don’t need to restart your computer just for that. Maybe you have started your server in another tab or terminal that’s why you get that error when trying to restart it again.
To be sure nothing is running somewhere, you can kill the Node process, and start your app properly.

Ah, so if I create a new terminal, I can’t kill the server if it is created on another terminal? This must be my problem.

Sometimes I create a lot of terminals because after I install dependencies in one terminal, I don’t have access to commands like NPM run dev in that same terminal. Is this normal to have to create many new terminals after installing dependencies?

Just type this in a terminal

    killall node

That should stop all your running node processes.

1 Like

that will do it… thanks

That’s not a problem. We all work with many terminals and forgot even where we started the app. The simplest solution, as said above, is to type killall node in any terminal.