I have been trying out AdonisJS recently, and I love using it. However, I often ran into a problem with it.
It uses Nodemon to watch the project, and restart the
server.js file. However, it would often crash (due to incomplete code - yes, I use auto-save) while I was working, and then not be able to start as it didn't quite properly, and was still running a process using a port (ususally 3000). So when Nodemon tried to restart the server, it couldn't as the port was already in use.
Dang. However, I found the command below usually fixed the problem. It basically just kills a process using a specific port:
sudo fuser -KILL -k -n tcp [port]
I use this so often, I created a ZSH alias for it:
alias kill="fuser -KILL -k -n tcp"
I use this like so:
It will then ask me for sudo permissions, then stop the process. Then you are free to proceed!