Storybook dev server default port: 6006
Storybook dev server uses TCP port 6006 by default. Without --exact-port, Storybook looks for a free port starting at the one you asked for and moves on. In an interactive terminal it asks whether to run on the new port instead and exits if you say no.
Key facts
| Port | Protocol | Role | Category |
|---|---|---|---|
| 6006 | TCP | Storybook dev server (conventional port) | Tooling |
What happens when the port is busy
Without --exact-port, Storybook looks for a free port starting at the one you asked for and moves on. In an interactive terminal it asks whether to run on the new port instead and exits if you say no. With --ci it moves without asking. With --exact-port it exits with the error “Port 6006 is not available. Exiting because --exact-port was provided.” Anything that expects 6006, such as the test runner, needs to be told the new URL.
Change the port
storybook dev -p 6007-p is the short form of --port. With no port at all, Storybook 10 asks the operating system for a free one, which is why most projects pin it.
storybook dev -p 6006 --exact-portStorybook attempts the exact port and exits with an error message if it is already in use.
{
"scripts": {
"storybook": "storybook dev -p 6007 --exact-port"
}
}Keeps the port in the repo. Give each project that runs Storybook its own number.
SBCONFIG_PORT=6007 storybook devUsed when --port is not passed. Storybook 10.5 and later fall back to PORT after it. --port always wins.
yarn test-storybook --url http://localhost:6007The test runner assumes a locally served Storybook on port 6006 unless you pass --url or set TARGET_URL.
Environment variable: SBCONFIG_PORT. Read when --port is not passed. Storybook 10.5 and later fall back to PORT after it, so a PORT exported for another tool can move Storybook too. --port always wins.
Bind address
In Storybook 10.6.2 the dev server listens on 127.0.0.1 unless you pass -h, --host (or set SBCONFIG_HOSTNAME). Earlier 10.x releases start it without a host, so Node listens on all interfaces. 0.0.0.0 binds to all interfaces. For hostnames behind a reverse proxy, add them to core.allowedHosts (default: empty). localhost, local network and --host addresses are always allowed.
What else uses this port
No other tool in this dataset uses port 6006 as a default.
The dataset is the 12 tools on the ports index.
Find and free this port
These commands find the process that holds TCP port 6006 and stop it. They come from the Port in use command generator. PID_NUMBER stands for the process ID you read from the first command: replace it before you run the others.
lsof -nP -iTCP:6006 -sTCP:LISTEN
ps -p PID_NUMBER -o pid,ppid,user,command
kill -TERM PID_NUMBERss -ltnp 'sport = :6006'
ps -p PID_NUMBER -o pid,ppid,user,command
kill -TERM PID_NUMBERGet-NetTCPConnection -LocalPort 6006 -State Listen -ErrorAction SilentlyContinue | Select-Object LocalAddress, LocalPort, State, OwningProcess
Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = PID_NUMBER" | Select-Object ProcessId, ParentProcessId, Name, CommandLine
Stop-Process -Id PID_NUMBERRead the output of the second command before you stop anything, because the owner may be a container or another person’s process. Then run the first command again to confirm the port is free.
Next free ports
Counting up from 6006, the next three ports that no tool in this dataset uses as a default are 6007, 6008, and 6009. They are suggestions only: another program on your machine may hold any of them, so run the find command above before you choose one.
Collisions in practice
6006 is a convention, not a built-in default: storybook init writes -p 6006 into your script and the test runner and Vitest addon assume it, but a bare storybook dev asks the operating system for a random free port. Storybook also usually runs beside your app on 3000 or 5173. If it lands on another port, anything still pointing at 6006 either fails to connect or tests an old instance. Fix one port per repo, add --exact-port so a clash stops the process, and give the test runner TARGET_URL when the port differs.
Frequently asked questions
How do I make Storybook fail if the port is busy?
Add --exact-port: storybook dev -p 6006 --exact-port. Storybook attempts the exact port you specify and exits with an error message if it is already in use.
Why can my Storybook test runner not connect after I changed the port?
The test runner assumes a locally served Storybook on port 6006. Pass --url with the new address, for example test-storybook --url http://localhost:6007, or set the TARGET_URL environment variable.
Is 6006 a fixed port?
No. It is the port storybook init writes into the storybook script (storybook dev -p 6006), and the port the test runner and the Vitest addon assume. The Vitest addon’s default is http://localhost:6006 and it has a storybookUrl option to override it. The CLI itself has no default: without --port, SBCONFIG_PORT or PORT, Storybook 10 picks a free port at random.
Is Storybook reachable from other devices on my network?
Not by default in Storybook 10.6.2, which listens on 127.0.0.1. Pass --host 0.0.0.0, or a specific address, to expose it. Storybook then warns that anyone on your network can open it, so do that only on a network you trust.
Sources
Busy ports in Rig
When a start fails because a port is taken, Rig shows which process owns it when it can, and lets you reclaim the port or choose another. You do not need Rig to use this page.