Skip to content
Latchkey

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

Storybook expanded the stories globs in .storybook/main and found zero matching files. The build then fails because there is nothing to compile, usually due to a wrong path, extension, or case mismatch.

What this error means

The build stops with "No story files found for the specified pattern: src/**/*.stories.@(js|jsx|ts|tsx)" even though stories exist locally.

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

Common causes

The glob does not match the actual paths

The stories pattern points at a directory or extension that does not exist in the checkout, so the expansion returns nothing.

Case-sensitive filesystem on the runner

Linux runners are case-sensitive, so a story named Button.Stories.tsx will not match a *.stories.tsx glob that builds fine on a case-insensitive local disk.

How to fix it

Point the glob at the real story locations

  1. List the actual story paths and extensions in the repo.
  2. Update the stories array in .storybook/main to match them exactly, including case.
  3. Re-run the build to confirm files are discovered.
.storybook/main.js
// .storybook/main.js
export default {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
};

Normalize story filename casing

Rename files so the extension case matches the glob, since CI runs on a case-sensitive filesystem.

How to prevent it

  • Keep the stories globs relative to .storybook and aligned with real paths.
  • Use consistent lowercase .stories. extensions so case-sensitive runners match.
  • Build Storybook in CI so an empty glob fails the PR, not production.

Frequently asked questions

What causes ""No story files found""?
The stories pattern points at a directory or extension that does not exist in the checkout, so the expansion returns nothing.
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