Use the following command to determine which process is using the port (replace PORT with the actual port number your application is trying to use, e.g., 8000):
sudo lsof -i :PORT
Once you have the PID, terminate it using the kill command:
sudo kill -9 PID