---
title: 'CLI options'
hideRendererSelector: true
sidebar:
  order: 8
  title: CLI options
---

The Storybook command line interface (CLI) is the main tool you use to build and develop Storybook.

<Callout variant="info">
  Storybook collects completely anonymous data to help us improve user experience. Participation is optional, and you may [opt-out](../configure/telemetry.mdx#how-to-opt-out) if you'd not like to share any information.
</Callout>

## API commands

All of the following documentation is available in the CLI by running `storybook --help`.

<Callout variant="info" icon="💡">
  Passing options to these commands works slightly differently if you're using npm instead of Yarn. You must prefix all of your options with `--`. For example, `npm run storybook build -- -o ./path/to/build --quiet`.
</Callout>

### `dev`

Compiles and serves a development build of your Storybook that reflects your source code changes in the browser in real-time. It should be run from the root of your project.

```shell
storybook dev [options]
```

Options include:

| Option                          | Description                                                                                                                                                                                              |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--help`                        | Output usage information <br />`storybook dev --help`                                                                                                                                                    |
| `-V`, `--version`               | Output the version number <br />`storybook dev -V`                                                                                                                                                       |
| `-p`, `--port [number]`         | Port to run Storybook <br />`storybook dev -p 9009`                                                                                                                                                      |
| `--exact-port [number]`         | Attempts to run Storybook on the exact port number specified.<br />If the port is already in use, Storybook will exit with an error message <br />`storybook dev --exact-port 9009`                      |
| `-h`, `--host [string]`         | Host to run Storybook <br />`storybook dev -h my-host.com`                                                                                                                                               |
| `-c`, `--config-dir [dir-name]` | Directory where to load Storybook configurations from <br />`storybook dev -c .storybook`                                                                                                                |
| `--loglevel [level]`            | Controls level of logging during build.<br /> Available options: `silly`, `verbose`, `info` (default), `warn`, `error`, `silent`<br />`storybook dev --loglevel warn`                                    |
| `--https`                       | Serve Storybook over HTTPS. Note: You must provide your own certificate information<br />`storybook dev --https`                                                                                         |
| `--ssl-ca`                      | Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)<br />`storybook dev --ssl-ca my-certificate`                                                  |
| `--ssl-cert`                    | Provide an SSL certificate. (Required with --https)<br />`storybook dev --ssl-cert my-ssl-certificate`                                                                                                   |
| `--ssl-key`                     | Provide an SSL key. (Required with --https)<br />`storybook dev --ssl-key my-ssl-key`                                                                                                                    |
| `--smoke-test`                  | Exit after successful start<br />`storybook dev --smoke-test`                                                                                                                                            |
| `--ci`                          | CI mode (skip interactive prompts, don't open browser)<br />`storybook dev --ci`                                                                                                                         |
| `--no-open`                     | Do not open Storybook automatically in the browser<br />`storybook dev --no-open`                                                                                                                        |
| `--quiet`                       | Suppress verbose build output<br />`storybook dev --quiet`                                                                                                                                               |
| `--debug`                       | Outputs more logs in the CLI to assist debugging<br />`storybook dev --debug`                                                                                                                            |
| `--debug-webpack`               | Display final webpack configurations for debugging purposes<br />`storybook dev --debug-webpack`                                                                                                         |
| `--stats-json [dir-name]`       | Write stats JSON to disk<br />Requires Webpack<br />`storybook dev --stats-json /tmp/stats`                                                                                                              |
| `--no-version-updates`          | Skips Storybook's update check<br />`storybook dev --no-version-updates`                                                                                                                                 |
| `--docs`                        | Starts Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.mdx#preview-storybooks-documentation)<br />`storybook dev --docs`                              |
| `--initial-path [path]`         | Configures the URL Storybook should open when it opens the browser for the first time<br />`storybook dev --initial-path=/docs/getting-started--docs`                                                    |
| `--preview-url [path]`          | Overrides the default Storybook preview with a custom built preview URL<br />`storybook dev --preview-url=http://localhost:1337/external-iframe.html`                                                    |
| `--force-build-preview`         | Forcefully builds Storybook's preview iframe.<br />Useful if you're experiencing issues, or combined with `--preview-url` to ensure the preview is up-to-date<br />`storybook dev --force-build-preview` |
| `--disable-telemetry`           | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook dev --disable-telemetry`                                                           |
| `--enable-crash-reports`        | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook dev --enable-crash-reports`             |

<Callout variant="warning" id="static-dir-deprecation">
  With the release of Storybook 8, the `-s` CLI flag was removed. We recommend using the [static directory](../configure/integration/images-and-assets.mdx#serving-static-files-via-storybook) instead if you need to serve static files.
</Callout>

### `build`

Compiles your Storybook instance so it can be [deployed](../sharing/publish-storybook.mdx). It should be run from the root of your project.

```shell
storybook build [options]
```

Options include:

| Option                          | Description                                                                                                                                                                                                            |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`                  | Output usage information<br />`storybook build --help`                                                                                                                                                                 |
| `-V`, `--version`               | Output the version number<br />`storybook build -V`                                                                                                                                                                    |
| `-o`, `--output-dir [dir-name]` | Directory where to store built files<br />`storybook build -o /my-deployed-storybook`                                                                                                                                  |
| `-c`, `--config-dir [dir-name]` | Directory where to load Storybook configurations from<br />`storybook build -c .storybook`                                                                                                                             |
| `--loglevel [level]`            | Controls level of logging during build.<br /> Available options: `silly`, `verbose`, `info` (default), `warn`, `error`, `silent`<br />`storybook build --loglevel warn`                                                |
| `--quiet`                       | Suppress verbose build output<br />`storybook build --quiet`                                                                                                                                                           |
| `--debug`                       | Outputs more logs in the CLI to assist debugging<br />`storybook build --debug`                                                                                                                                        |
| `--debug-webpack`               | Display final webpack configurations for debugging purposes<br />`storybook build --debug-webpack`                                                                                                                     |
| `--stats-json [dir-name]`       | Write stats JSON to disk<br />Requires Webpack<br />`storybook build --stats-json /tmp/stats`                                                                                                                          |
| `--docs`                        | Builds Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.mdx#publish-storybooks-documentation)<br />`storybook build --docs`                                          |
| `--test`                        | Optimize Storybook's production build for performance and tests by removing unnecessary features with the `test` option. Learn more [here](../api/main-config/main-config-build.mdx).<br />`storybook build --test`    |
| `--preview-url [path]`          | Overrides the default Storybook preview with a custom built preview URL<br />`storybook build --preview-url=http://localhost:1337/external-iframe.html`                                                                |
| `--force-build-preview`         | Forcefully builds Storybook's preview iframe.<br />Useful if you're experiencing issues, or combined with `--preview-url` to ensure the preview is up-to-date<br />`storybook build --force-build-preview`             |
| `--disable-telemetry`           | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook build --disable-telemetry`                                                                       |
| `--enable-crash-reports`        | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook build --enable-crash-reports`                         |

### `init`

Installs and initializes the specified version (e.g., `@latest`, `@8`, `@next`) of Storybook into your project. Read more in the [installation guide](../get-started/install.mdx).

```shell
storybook[@version] init [options]
```

For example, `storybook@latest init` will install the latest version of Storybook into your project.

Options include:

| Option                   | Description                                                                                                                                                                                    |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`           | Output usage information <br />`storybook init --help`                                                                                                                                         |
| `-b`, `--builder`        | Defines the [builder](../builders/index.mdx) to use for your Storybook instance<br />`storybook init --builder webpack5`                                                                       |
| `-f`,`--force`           | Forcefully installs Storybook into your project, prompting you to overwrite existing files<br />`storybook init --force`                                                                       |
| `-s`, `--skip-install`   | Skips the dependency installation step. Used only when you need to configure Storybook manually<br />`storybook init --skip-install`                                                           |
| `-t`, `--type`           | Defines the [framework](../configure/integration/frameworks.mdx) to use for your Storybook instance<br />`storybook init --type solid`                                                         |
| `-y`, `--yes`            | Skips interactive prompts and automatically installs Storybook per specified version<br />`storybook init --yes`                                                                               |
| `--package-manager`      | Sets the package manager to use when installing Storybook.<br /> Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook init --package-manager pnpm`                     |
| `--use-pnp`              | Enables [Plug'n'Play](https://yarnpkg.com/features/pnp) support for Yarn. This option is only available when using Yarn as your package manager<br />`storybook init --use-pnp`                |
| `-p`, `--parser`         | Sets the [jscodeshift parser](https://github.com/facebook/jscodeshift#parser).<br /> Available parsers include `babel`, `babylon`, `flow`, `ts`, and `tsx`<br />`storybook init --parser tsx`  |
| `--debug`                | Outputs more logs in the CLI to assist debugging<br />`storybook init --debug`                                                                                                                 |
| `--disable-telemetry`    | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook init --disable-telemetry`                                                |
| `--enable-crash-reports` | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook init --enable-crash-reports`  |
| `--no-dev`               | Complete the initialization of Storybook without running the Storybook dev server<br />`storybook init --no-dev`                                                                               |

### `add`

Installs a Storybook addon and configures your project for it. Read more in the [addon installation guide](../addons/install-addons.mdx).

```shell
storybook add [addon] [options]
```

Options include:

| Option                     | Description                                                                                                                                                                       |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`             | Output usage information <br />`storybook add --help`                                                                                                                             |
| `-c`, `--config-dir`       | Directory where to load Storybook configurations from<br />`storybook migrate --config-dir .storybook`                                                                            |
| `--package-manager`        | Sets the package manager to use when installing the addon.<br /> Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook add [addon] --package-manager pnpm` |
| `-s`, `--skip-postinstall` | Skips post-install configuration. Used only when you need to configure the addon yourself<br />`storybook add [addon] --skip-postinstall`                                         |
| `--debug`                  | Outputs more logs in the CLI to assist debugging<br />`storybook add --debug`                                                                                                     |

### `remove`

Deletes a Storybook addon from your project. Read more in the [addon installation guide](../addons/install-addons.mdx#removing-addons).

```shell
storybook remove [addon] [options]
```

Options include:

| Option                   | Description                                                                                                                                                                                     |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`           | Output usage information <br />`storybook remove --help`                                                                                                                                        |
| `--package-manager`      | Sets the package manager to use when removing the addon.<br />Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook remove [addon]--package-manager pnpm`                |
| `--debug`                | Outputs more logs in the CLI to assist debugging<br />`storybook remove --debug`                                                                                                                |
| `--disable-telemetry`    | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook remove --disable-telemetry`                                               |
| `--enable-crash-reports` | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook remove --enable-crash-reports` |

### `upgrade`

Upgrades your Storybook instance to the specified version (e.g., `@latest`, `@8`, `@next`). Read more in the [upgrade guide](../configure/upgrading.mdx).

```shell
storybook[@version] upgrade [options]
```

For example, `storybook@latest upgrade --dry-run` will perform a dry run (no actual changes) of upgrading your project to the latest version of Storybook.

Options include:

| Option                   | Description                                                                                                                                                                                      |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `-h`, `--help`           | Output usage information <br />`storybook upgrade --help`                                                                                                                                        |
| `-c`, `--config-dir`     | Directory where to load Storybook configurations from<br />`storybook upgrade --config-dir .storybook`                                                                                           |
| `-n`, `--dry-run`        | Checks for version upgrades without installing them<br />`storybook upgrade --dry-run`                                                                                                           |
| `-s`, `--skip-check`     | Skips the migration check step during the upgrade process<br /> `storybook upgrade --skip-check`                                                                                                 |
| `-y`, `--yes`            | Skips interactive prompts and automatically upgrades Storybook to the latest version<br />`storybook upgrade --yes`                                                                              |
| `-f`,`--force`           | Force the upgrade, skipping autoblockers check<br />`storybook upgrade --force`                                                                                                                  |
| `--package-manager`      | Sets the package manager to use when upgrading Storybook.<br /> Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook upgrade --package-manager pnpm`                     |
| `--debug`                | Outputs more logs in the CLI to assist debugging<br />`storybook upgrade --debug`                                                                                                                |
| `--disable-telemetry`    | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook upgrade --disable-telemetry`                                               |
| `--enable-crash-reports` | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook upgrade --enable-crash-reports` |

### `migrate`

Runs the provided codemod to ensure your Storybook project is compatible with the specified version. Read more in the [migration guide](../configure/upgrading.mdx).

```shell
storybook[@version] migrate [codemod] [options]
```

<Callout variant="info">
  The command requires the codemod name (e.g., `csf-2-to-3`) as an argument to apply the necessary changes to your project. You can find the list of available codemods by running `storybook migrate --list`.
</Callout>

For example, `storybook@latest migrate csf-2-to-3 --dry-run`, checks your project to verify if the codemod can be applied without making any changes, providing you with a report of which files would be affected.

Options include:

| Option                     | Description                                                                                                                                                                                      |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `-h`, `--help`             | Output usage information <br />`storybook migrate --help`                                                                                                                                        |
| `-c`, `--config-dir`       | Directory where to load Storybook configurations from<br />`storybook migrate --config-dir .storybook`                                                                                           |
| `-n`, `--dry-run`          | Verify the migration exists and show the files to which it will be applied<br />`storybook migrate --dry-run`                                                                                    |
| `-l`, `--list`             | Shows a list of available codemods<br /> `storybook migrate --list`                                                                                                                              |
| `-g`, `--glob`             | Glob for files upon which to apply the codemods<br />`storybook migrate --glob src/**/*.stories.tsx`                                                                                             |
| `-p`, `--parser`           | Sets the [jscodeshift parser](https://github.com/facebook/jscodeshift#parser).<br /> Available parsers include `babel`, `babylon`, `flow`, `ts`, and `tsx`<br />`storybook migrate --parser tsx` |
| `-r`, `--rename [from-to]` | Renames the files affected by the codemod to include the provided suffix<br />`storybook migrate --rename ".js:.ts"`                                                                             |
| `--debug`                  | Outputs more logs in the CLI to assist debugging<br />`storybook migrate --debug`                                                                                                                |

### `automigrate`

Perform standard configuration checks to determine if your Storybook project can be automatically migrated to the specified version. Read more in the [migration guide](../configure/upgrading.mdx#automigrate-script).

```shell
storybook[@version] automigrate [fixId] [options]
```

For example, `storybook@latest automigrate --dry-run` scans your project for potential migrations that can be applied automatically without making any changes.

Options include:

| Option                   | Description                                                                                                                                                                                                               |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`           | Output usage information <br />`storybook automigrate --help`                                                                                                                                                             |
| `-c`, `--config-dir`     | Directory where to load Storybook configurations from<br />`storybook automigrate --config-dir .storybook`                                                                                                                |
| `-n`, `--dry-run`        | Checks for available migrations without applying them<br />`storybook automigrate --dry-run`                                                                                                                              |
| `-s`, `--skip-install`   | Skip installing dependencies whenever applicable<br /> `storybook automigrate --skip-install`                                                                                                                             |
| `-y`, `--yes`            | Applies available migrations automatically without prompting for confirmation<br />`storybook automigrate --yes`                                                                                                          |
| `-l`, `--list`           | Shows a list of available automigrations<br /> `storybook automigrate --list`                                                                                                                                             |
| `--package-manager`      | Sets the package manager to use when running the auto migration.<br /> Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook automigrate --package-manager pnpm`                                   |
| `--renderer`             | Specifies Storybook's renderer to use when running the automigration.<br /> Useful for monorepo environments where multiple Storybook instances can exist in the same project<br />`storybook automigrate --renderer vue` |
| `--debug`                | Outputs more logs in the CLI to assist debugging<br />`storybook automigrate --debug`                                                                                                                                     |
| `--disable-telemetry`    | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook automigrate --disable-telemetry`                                                                    |
| `--enable-crash-reports` | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook automigrate --enable-crash-reports`                      |

### `doctor`

Performs a health check on your Storybook project for common issues (e.g., duplicate dependencies, incompatible addons or mismatched versions) and provides suggestions on how to fix them. Applicable when [upgrading](../configure/upgrading.mdx#verifying-the-upgrade) Storybook versions.

```shell
storybook doctor [options]
```

Options include:

| Option               | Description                                                                                                                                                                     |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-h`, `--help`       | Output usage information <br />`storybook doctor --help`                                                                                                                        |
| `-c`, `--config-dir` | Directory where to load Storybook configurations from<br />`storybook doctor --config-dir .storybook`                                                                           |
| `--package-manager`  | Sets the package manager to use when running the health check.<br />Available package managers include `npm`, `yarn`, and `pnpm`<br />`storybook doctor --package-manager pnpm` |
| `--debug`            | Outputs more logs in the CLI to assist debugging<br />`storybook doctor --debug`                                                                                                |

### `info`

Reports useful debugging information about your environment. Helpful in providing information when opening an issue or a discussion.

```shell
storybook info
```

Example output:

```shell
Storybook Environment Info:

  System:
    OS: macOS 14.2
    CPU: (8) arm64 Apple M3
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm <----- active
  Browsers:
    Chrome: 120.0.6099.199
  npmPackages:
    @storybook/addon-essentials: ^7.6.6 => 7.6.6
    @storybook/addon-interactions: ^7.6.6 => 7.6.6
    @storybook/addon-links: ^7.6.6 => 7.6.6
    @storybook/addon-onboarding: ^1.0.10 => 1.0.10
    @storybook/blocks: ^7.6.6 => 7.6.6
    @storybook/preset-create-react-app: ^7.6.6 => 7.6.6
    @storybook/react: ^7.6.6 => 7.6.6
    @storybook/react-webpack5: ^7.6.6 => 7.6.6
    @storybook/test: ^7.6.6 => 7.6.6
    storybook: ^7.6.6 => 7.6.6
  npmGlobalPackages:
    chromatic: ^10.2.0 => 10.2.0
```

### `sandbox`

Generates a local sandbox project using the specified version (e.g., `@latest`, `@8`, `@next`) for testing Storybook features based on the list of supported [frameworks](../configure/integration/frameworks.mdx). Useful for reproducing bugs when opening an issue or a discussion.

```shell
storybook[@version] sandbox [framework-filter] [options]
```

For example, `storybook@next sandbox` will generated sandboxes using the newest pre-release version of Storybook.

The `framework-filter` argument is optional and can filter the list of available frameworks. For example, `storybook@next sandbox react` will only offer to generate React-based sandboxes.

Options include:

| Option                      | Description                                                                                                                                                                                      |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `-h`, `--help`              | Output usage information <br />`storybook sandbox --help`                                                                                                                                        |
| `-o`, `--output [dir-name]` | Configures the location of the sandbox project<br />`storybook sandbox --output /my-sandbox-project`                                                                                             |
| `--no-init`                 | Generates a sandbox project without without initializing Storybook<br />`storybook sandbox --no-init`                                                                                            |
| `--debug`                   | Outputs more logs in the CLI to assist debugging<br />`storybook sandbox --debug`                                                                                                                |
| `--disable-telemetry`       | Disables Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#how-to-opt-out)<br />`storybook sandbox --disable-telemetry`                                               |
| `--enable-crash-reports`    | Enables sending crash reports to Storybook's telemetry. Learn more about it [here](../configure/telemetry.mdx#crash-reports-disabled-by-default)<br />`storybook sandbox --enable-crash-reports` |

<Callout variant="info">
  If you're looking for a hosted version of the available sandboxes, see [storybook.new](https://storybook.new).
</Callout>
