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.

Frequently asked questions

What causes ""Cannot find module '@storybook/...'""?
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.
How do I fix "Cannot find module '@storybook/...'"?
Install the exact framework package

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card