Port remains open after terminating yarn run start

I’ll do a yarn run start and get https://localhost:3000/ as default.

Terminate it by CTRL + Z
[2]+ Stopped yarn run start

Run yarn run start again and now I am on port 3002.

I checked Activity Monitor (Mac) and node is still running. I have to force quit the process(s) still running or just deal with being on a different port every time yarn run start is run.

Any idea why the node process would still run after closing?

I am on a Mac too.

I of course immediately found out why after posting the above ha.

To end the program, you should be using Ctrl + C. If you do that, it sends SIGINT , which allows the program to end gracefully, unbinding from any ports it is listening on.

Ctrl+Z suspends it, which means it can still be running.

Ctrl+C will actually kill it.

1 Like