-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick win: buildStoriesJson breaks storiesOf stories with error Error: CSF: unexpected storiesOf call #18640
Comments
Facing similar issue:
|
I got a similar error when I enable the storyStoreV7 feature in Storybook v6.5.15. I don't use ...
info More info: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
info 💡 Skipping node_modules/@storybook/react/dist/cjs/client/docs/react-argtypes.stories.js: NoMetaError: CSF: missing default export /home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/react/dist/cjs/client/docs/react-argtypes.stories.js (line 1, col 0)
info
info More info: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
WARN 🚨 Extraction error on node_modules/@storybook/react/dist/esm/client/docs/react-argtypes.stories.js: Error: CSF: unexpected storiesOf call /home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/react/dist/esm/client/docs/react-argtypes.stories.js (line 82, col 20)
WARN
WARN More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-store-v7
/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/csf-tools/dist/cjs/CsfFile.js:473
throw new Error((0, _tsDedent.default)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n CSF: unexpected storiesOf call ", "\n\n More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-store-v7\n "])), formatLocation(node, self._fileName)));
^
Error: CSF: unexpected storiesOf call /home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/react/dist/esm/client/docs/react-argtypes.stories.js (line 82, col 20)
More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#story-store-v7
at enter (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/csf-tools/dist/cjs/CsfFile.js:473:21)
at NodePath._call (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:46:20)
at NodePath.call (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:36:17)
at NodePath.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:84:31)
at TraversalContext.visitQueue (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:96:16)
at TraversalContext.visitSingle (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:72:19)
at TraversalContext.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:121:19)
at traverseNode (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at NodePath.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:90:52)
at TraversalContext.visitQueue (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:96:16)
at TraversalContext.visitMultiple (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:67:17)
at TraversalContext.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:119:19)
at traverseNode (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at NodePath.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:90:52)
at TraversalContext.visitQueue (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:96:16)
at TraversalContext.visitMultiple (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:67:17)
at TraversalContext.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:119:19)
at traverseNode (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at NodePath.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/path/context.js:90:52)
at TraversalContext.visitQueue (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:96:16)
at TraversalContext.visitSingle (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:72:19)
at TraversalContext.visit (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/context.js:121:19)
at traverseNode (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at traverse (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@babel/traverse/lib/index.js:50:34)
at CsfFile.parse (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/csf-tools/dist/cjs/CsfFile.js:325:29)
at StoryIndexGenerator.extractStories (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/core-server/dist/cjs/utils/StoryIndexGenerator.js:127:11)
at async Promise.all (index 65)
at async Promise.all (index 1)
at async StoryIndexGenerator.ensureExtracted (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/core-server/dist/cjs/utils/StoryIndexGenerator.js:103:13)
at async StoryIndexGenerator.initialize (/home/dzegarra/Projects/ABB20/User_Interface/node_modules/@storybook/core-server/dist/cjs/utils/StoryIndexGenerator.js:97:5) |
I discovered my problem! I had these paths for stories in module.exports = {
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
// ...
} It was parsing even the I changed it to: module.exports = {
stories: [
'../src/**/*.stories.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
],
// ...
} And the error went away. |
I had the same issue right now. I think the problem is that Storybook is resolving stories inside @dzegarra thanks for the advice, changing the path to a more specific one (not including |
We could exclude We could also improve the error message if we didn't want to exclude node_modules, but I'm wondering what it should say if we did. Any suggestions? |
"Your include path in .storybook/main.js includes node_modules. That means Stories from your dependencies will be considered as well. Is that what you want? It's recommended to only include the paths where your Stories can find found." |
@shilman for what it's worth, excluding About the error message, yes maybe something like "this story is located inside a |
Quick win: Add a |
Closes storybookjs#18640 * [x] exclude node_modules from the glob used for indexing stories by default unless explicitly specified * [x] show a little warning when node_modules is mentioned explicitly
The |
Describe the bug
Not documented anywhere - if you are setting buildStoriesJson to true, you cannot define stories with storiesOf
To Reproduce
Create a story with storiesOf and set buildStoriesJson in main to true
System
OS: macOS 12.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.13.2 - ~/.nvm/versions/node/v18.4.0/bin/npm
Browsers:
Chrome: 103.0.5060.114
Firefox: 97.0
Safari: 15.5
npmPackages:
@storybook/addon-actions: ^6.5.9 => 6.5.9
@storybook/addon-essentials: ^6.5.9 => 6.5.9
@storybook/addon-interactions: ^6.5.9 => 6.5.9
@storybook/addon-links: ^6.5.9 => 6.5.9
@storybook/angular: ^6.5.9 => 6.5.9
@storybook/builder-webpack5: ^6.5.9 => 6.5.9
@storybook/jest: ^0.0.10 => 0.0.10
@storybook/manager-webpack5: ^6.5.9 => 6.5.9
@storybook/testing-library: ^0.0.13 => 0.0.13
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: