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.
=> 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
- List where story files actually live relative to
.storybook. - Widen or correct the
storiesglob to include those paths and extensions. - Set the step working directory if it is a monorepo package.
// .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.
- name: Build Storybook
working-directory: packages/ui
run: npm run build-storybookHow to prevent it
- Keep story globs relative to
.storybookand covering every story extension. - Set
working-directoryexplicitly for monorepo package builds. - Verify
storybook buildlocally from a clean checkout.