Fix For Address Already In Use :::5432: SPFx Development With Gulp

In this blog, we will learn how to solve the "port in use" error for localhost port 4321 during SPFX development.

The Problem

 
I was working on developing SharePoint Framework solutions using Yeoman and Gulp on my local machine. More importantly, I was working on multiple projects at once. 
 
When I ran the gulp-serve command, I got the below error. The Localhost server was opening the previous solution that I was working. 
 
[18:00:10] Error - Unknown
listen EADDRINUSE: address already in use :::5432
[18:00:13] Error - 'undefined' errored after
"orchestration aborted"
 

What caused the error?

 
One of the previous instances of the live server with Gulp did not close properly. That means there was an active process still running and utilizing that particular port; in my case, 4321.
 

What can you do to fix it?

 
Well, the easy answer is to kill the node process that is running the live server with Gulp.
 
 taskkill /f /im node.exe
 
/f forces it to kill the process.
 
Then, run the gulp-serve command again. It should start the live server without an error.
 
I hope this will help someone with the same problem.