Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Node.js server?

I've just setup MEAN stack on my DigitalOcean server. I got the test app to run fine, but now when I open command line from DigitalOcean it just shows info: GET /modules/etc... and the part where I type is blank. How do I stop the server and get it back to where it was originally so I can access folders etc.?

Simply doing CTRL+C does not stop the server from running, which is what I need to do.

like image 853
Alanay Avatar asked Oct 23 '25 19:10

Alanay


1 Answers

At first: CTRL+Z will terminate the execution. Later, in order to terminate the PID(processID), follow the following.

The generalised approach for kill any processId including localserver:

Reference: https://stackoverflow.com/a/57536823/8119511

For this case:

$:lsof -i tcp:<PORT>

It will bring you out with the PID(processId) associated with port:

$:kill -9 <process-id>

And again, you can runserver.

like image 71
Ank_247shbm Avatar answered Oct 25 '25 08:10

Ank_247shbm