Run Sveltekit Application on user defined port number

When developing web applications, the ability to run your app on a specific port can be crucial for avoiding conflicts with other processes and for setting up environments that mirror your production setup.
SvelteKit, a popular framework for building high-performance web applications, allows developers to easily set a custom
port.
To run your SvelteKit application on a specific port, use the following command:
npm run dev -- --host --port 5175
To see if a specific port, such as 5173, is in use, you can use one of the following commands:
netstat -an | findstr /i " :5173"
without PID
or
netstat -ano | findstr :5173
with PID
C:\Users\sabbirz>netstat -ano | findstr :5173
TCP 0.0.0.0:5173 0.0.0.0:0 LISTENING 8872
TCP 0.0.0.0:5174 0.0.0.0:0 LISTENING 5100
TCP 192.168.100.161:5173 192.168.100.161:60818 ESTABLISHED 8872
TCP 192.168.100.161:60818 192.168.100.161:5173 ESTABLISHED 26260
TCP [::]:5173 [::]:0 LISTENING 8872
TCP [::]:5174 [::]:0 LISTENING 5100
TCP [::1]:5173 [::1]:60819 ESTABLISHED 8872
TCP [::1]:5173 [::1]:60824 ESTABLISHED 8872
TCP [::1]:60819 [::1]:5173 ESTABLISHED 26260
TCP [::1]:60824 [::1]:5173 ESTABLISHED 26260
The last value
8872
is the PID of the process using the port.
If you find that a needed port is in use and you wish to close it, you can terminate the process using its PID.
PID
of the process using the port from the netstat
output. taskkill /PID [PID Value] /F
Always ensure that you are terminating the correct process. Accidentally closing vital system processes can cause system instability or data loss.