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.
=> 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
- List the actual story paths and extensions in the repo.
- Update the
storiesarray in.storybook/mainto match them exactly, including case. - Re-run the build to confirm files are discovered.
// .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
storiesglobs relative to.storybookand 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.