@maxbo/free-port
v1.2.0
Published
A utility to free a port prior to use. Add this before starting a server and it will kill the process using the port, optionally prompting before doing so. It will also stop docker containers without stopping the entire docker process.
Downloads
20
Maintainers
Readme
free-port
A simple utility to free a port prior to use, optionally prompting before stopping the process.
If it finds that the port is being used by Docker it will stop the container using the port rather than stopping the whole Docker process and killing all your containers with it.
Its particularly useful to add this to your npm scripts before starting a server on a specific port. This will allow you to stop the process thats preventing this one from starting without having to go and find it.
Usage
free-port <port> [options]
Options
-s, --skipPrompt
Don't prompt before killing the process on the requested port.
Examples
Free port 3000 - prompt before killing processes
free-port 3000
Free port 3000 - don't prompt before killing processes
free-port 3000 -s
Add before starting a web server in your package.json
free-port 3000 && start-server 3000