Skip to content

Instantly share code, notes, and snippets.

Last active April 17, 2022 00:48
What would you like to do?
Something is already running on port 6969


Have you ever encountered something like Error: listen EADDRINUSE: address already in use :::3000 when your app is starting?

After which you have to change the port or shutdown whatever is running on the already used one...


npm i react-dev-utils
import { choosePort } from 'react-dev-utils/WebpackDevServerUtils'

Wherever you need to use the port, just use const port = await choosePort(HOST, PORT) instead.

If you're sure you'll be running on localhost, you can set HOST to whatever, like undefined. React uses afaik.

+const port = await choosePort('', PORT)
+http.listen(port, function () {
-http.listen(PORT, function () {
  console.log(`App started!`)


On your app start, if the port is taken, the terminal will simply ask you to approve port changing. Press Enter and you're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment