Skip to content
Latchkey

Storybook "Failed to load preset" in CI

Storybook resolves every entry in addons and the framework as a preset. "Failed to load preset" means one of them could not be required, usually because the package is missing from a clean CI install or its version mismatches the Storybook core.

What this error means

The build fails early with "Failed to load preset: '@storybook/addon-...'" or "Failed to load preset: .../preset.js", often followed by "Cannot find module".

storybook
Error: Failed to load preset: "@storybook/addon-essentials/preset" on level 1
Cannot find module '@storybook/addon-essentials/preset'

Common causes

The addon is not installed in CI

It works locally because it is present, but it was never added to package.json, so a clean npm ci in CI does not install it.

A version mismatch between core and preset

The addon major does not match the Storybook major (a 7 addon under Storybook 8), so its preset export cannot initialize.

How to fix it

Install the preset and align versions

  1. Add the named addon to devDependencies so npm ci installs it.
  2. Match its major version to your Storybook core version.
  3. Commit the lockfile and re-run the build.
Terminal
npm install -D @storybook/addon-essentials@^8

Remove a preset you no longer use

If the addon was deleted, drop it from the addons array in .storybook/main.js so Storybook stops trying to load it.

.storybook/main.js
// .storybook/main.js
export default {
  addons: ['@storybook/addon-essentials'],
};

How to prevent it

  • Keep every addon in package.json at a version matching Storybook core.
  • Run npm ci (clean install) locally to catch missing addons before CI.
  • Bump addons together with Storybook using its upgrade command.

Frequently asked questions

What causes ""Failed to load preset""?
It works locally because it is present, but it was never added to package.json, so a clean npm ci in CI does not install it.
How do I fix "Failed to load preset"?
Install the preset and align versions

Related guides

References

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