Skip to content
Latchkey

Storybook "Cannot find module '@storybook/...'" in CI

Node could not resolve a @storybook/* package that your .storybook config or a story file imports. The framework, renderer, or addon package is missing from the runner's installed dependencies.

What this error means

Running storybook build or storybook dev fails with "Error: Cannot find module '@storybook/react'" (or another @storybook package) before any stories load.

storybook
Error: Cannot find module '@storybook/react'
Require stack:
- /home/runner/work/app/app/.storybook/main.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1145:15)

Common causes

The package is not in package.json

A renderer or framework package (@storybook/react, @storybook/react-vite) is imported by config but was never added as a dependency, so a clean CI install never fetches it.

A version skew after a Storybook major upgrade

After upgrading the core, the renderer package name changed, leaving config pointing at a package that is no longer installed.

How to fix it

Install the exact framework package

  1. Read which @storybook/* package the require stack names.
  2. Add it to devDependencies and reinstall.
  3. Re-run the Storybook build to confirm it resolves.
Terminal
npm install --save-dev @storybook/react @storybook/react-vite

Keep all @storybook packages on one version

Mixed Storybook versions cause resolution failures. Align core, renderer, and addons to the same version.

Terminal
npx storybook@latest upgrade

How to prevent it

  • Declare every Storybook framework and addon package in devDependencies.
  • Use storybook upgrade so all @storybook packages stay on one version.
  • Run a clean install in CI so missing packages surface, not local leftovers.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →