How to stop npm serve
I had the same problem using serve to serve the production build of my react app (built from create-react-app).
I was able to finally kill it by using serve again somewhere else on my filesystem (like my home directory and then killing it with: Ctrl + c
.
You can do something like this to kill your react app being served by serve:
> cd ~
> serve
And then use Ctrl + c
Then go to http://localhost:5000 to confirm nothing is being served.
You can use the command below:
$ killall -9 node
I had the same problem when using serve for production build. I terminated the port instead of stopping Serve.
sudo fuser -k <portno>/tcp
You can stop the process on the console like any other process: Ctrl + c
.
See https://superuser.com/questions/103909/how-to-stop-a-process-in-terminal