When I run my storybook sometimes my components are missing.
So I have
"... New folderworkingtestwithpawelsrccomponentsAi4Process_mylib_test2demo.stories.tsx"
But storybook won’t see the file
Here is my .storybook/main.js which defines where to look for stories.
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
const config = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
framework: {
name: '@storybook/react-webpack5'
},
docs: {
autodocs: 'tag'
}
};
export default config;
What do I need to do to fix it so storybook sees my components?
I’m still unable to get storybook to see my component but could the error be due to this seeming to hang?
2
Answers
I was able to pull the repository on my computer (a Mac) and see the story without changing anything, which means the configuration is correct. Here are a few hypotheses on why it might not be working in your case:
Corrupted Node modules:
node_modules
directory in your project.package-lock.json
.npm install
again.Legacy Node runtime:
node_modules
andpackage-lock.json
.npm install
again to see if the updated Node version resolves the issue.Windows file system:
Your Storybook configuration seems mostly correct, but the issue might lie in the way paths are specified or the structure of your project. Here are a few things you can check and try to resolve the issue:
Ensure that the path in your stories configuration is correct and matches the actual file path.
Ensure that there are no discrepancies in the folder names and their capitalisation
Sometimes, Storybook may cache previous configurations. Clearing the cache might help.
npx storybook –no-manager-cache
Ensure all Storybook dependencies are compatible and up-to-date. Sometimes issues arise from version mismatches.
Add the exact path of the story file to the stories array in your .storybook/main.js file to see if it makes a difference.