Skip to content
Latchkey

Storybook "No story files found for the specified pattern" in CI

Storybook expanded the globs in your stories array against the CI working directory and matched zero files. The build aborts because there is nothing to compile.

What this error means

The build stops with "No story files found for the specified pattern: ..." listing the glob(s) from .storybook/main.js.

storybook
=> Failed to build the preview
No story files found for the specified pattern: src/**/*.stories.@(js|jsx|ts|tsx)

Common causes

The glob is relative to a different directory in CI

The pattern assumes a working directory the CI step is not in (a monorepo package), so it resolves to an empty set.

Story files are excluded or the extension differs

The stories use .mdx or a .story.tsx suffix the glob does not include, so none match.

How to fix it

Point the glob at the real story locations

  1. List where story files actually live relative to .storybook.
  2. Widen or correct the stories glob to include those paths and extensions.
  3. Set the step working directory if it is a monorepo package.
.storybook/main.ts
// .storybook/main.ts
export default {
  stories: ['../src/**/*.stories.@(ts|tsx|mdx)'],
};

Run the build from the package directory

In a monorepo, set the working directory so relative globs resolve to the right package.

.github/workflows/ci.yml
- name: Build Storybook
  working-directory: packages/ui
  run: npm run build-storybook

How to prevent it

  • Keep story globs relative to .storybook and covering every story extension.
  • Set working-directory explicitly for monorepo package builds.
  • Verify storybook build locally from a clean checkout.

Frequently asked questions

What causes ""No story files found""?
The pattern assumes a working directory the CI step is not in (a monorepo package), so it resolves to an empty set.
How do I fix "No story files found"?
Point the glob at the real story locations

Related guides

References

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