Storybook addon "Cannot find module '@storybook/...'" in CI
Node could not resolve a @storybook/... package that your config or a story imports. On a clean CI runner this almost always means the package is missing from package.json or the lockfile.
What this error means
The build throws "Error: Cannot find module '@storybook/addon-interactions'" (or another Storybook package) even though it runs locally.
storybook
Error: Cannot find module '@storybook/addon-interactions'
Require stack:
- /home/runner/work/app/app/.storybook/main.tsCommon causes
The package is not in package.json
It was installed locally but never saved, so npm ci on the runner never brings it in.
A stale lockfile missing the dependency
The lockfile predates adding the addon, so a locked install omits it.
How to fix it
Install and lock the missing package
- Add the exact
@storybook/...package the stack trace names. - Match its major to your Storybook version.
- Commit the updated lockfile so
npm ciinstalls it.
Terminal
npm install -D @storybook/addon-interactions@^8
git add package-lock.jsonUse a clean install to reproduce CI locally
Delete node_modules and run the locked install to surface the missing package before pushing.
Terminal
rm -rf node_modules
npm ci
npm run build-storybookHow to prevent it
- Always
npm install -Daddons so they land inpackage.json. - Commit the lockfile in the same change as the addon.
- Reproduce CI with
npm ciafter removingnode_modules.
Related guides
Storybook "Failed to load preset" in CIFix Storybook "Failed to load preset" in CI - Storybook tried to load an addon or framework preset that is no…
Storybook "framework field ... is required" (SB6 to 7/8 migration) in CIFix Storybook "framework field in main.js is required" after upgrading from 6 to 7 or 8 in CI - the config mu…
Storybook build "Module not found: Error: Can't resolve" in CIFix "storybook build" failing with "Module not found: Error: Can't resolve" in CI - the builder cannot resolv…