Storybook "storybook dev" port already in use in CI
Storybook binds a TCP port (6006 by default) to serve the dev preview. If another process already holds it, the dev server cannot start. In CI this usually means a previous Storybook was left running, or two steps race for the same port.
What this error means
Starting storybook dev fails with "Port 6006 is already in use" or Node prints "Error: listen EADDRINUSE: address already in use :::6006".
Error: listen EADDRINUSE: address already in use :::6006
at Server.setupListenHandle [as _listen2] (node:net:...)Common causes
A leftover Storybook process holds the port
A background storybook dev from an earlier step never exited, so the port is still bound.
Two steps bind the same port
A static server for the test-runner and a storybook dev both try to use 6006 concurrently.
How to fix it
Use a distinct port or a static build
- Prefer serving the static
storybook-staticfor the test-runner instead ofstorybook dev. - If you need dev mode, pass an explicit free port with
-p. - Ensure earlier background servers are stopped before rebinding.
npx storybook dev -p 6007 --ciServe the static build for tests
A static server started with concurrently avoids a lingering dev server and is more reliable in CI.
npx concurrently -k -s first \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && npx test-storybook"How to prevent it
- Serve the static build rather than
storybook devin CI. - Use
concurrently -kso background servers are torn down. - Pass an explicit free port when a default may be taken.