I have just started a new nx workspace from scratch using react and vite. I have added some simple libraries with some ui components and everything works as expected.
Now I was trying to add storybook to one of those libraries following the documentation here.
After executing:
nx add @nx/storybook
nx g @nx/storybook:configuration ui --js --uiFramework=react-vite
Storybook configurations on project and nx.json seems to be well generated but when I executed:
nx run ui:storybook
I have the following error:
NX Unable to create nodes for libs/ui/.storybook/main.js using plugin @nx/storybook/plugin.
Inner Error: TypeError: Cannot read properties of undefined (reading 'parent')
at traverse (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/traverse.js:45:38)
at traverseChildren (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/traverse.js:30:5)
at match (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/match.js:12:37)
at Function.query (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/query.js:12:30)
at getStorybookConfig (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:169:60)
at buildStorybookTargets (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:68:32)
at exports.createNodes (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:52:15)
at buildProjectsConfigurationsFromProjectPathsAndPlugins (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
at createProjectConfigurations (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
at _retrieveProjectConfigurations (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
I am using version 18.0.5 of nx. Some of nx and storybook libraries on my package.json:
I could not find anything about this error. It seems to be internal and while trying to execute storybook plugin. It seems that main.js is not even executed because I have tried some changes on it and the error was always the same.
Expected Behavior
Storybook to start for selected project.
GitHub Repo
No response
Steps to Reproduce
Create a new nx workspace (integrated monorepo) with react-vite, e.g npx create-nx-workspace@latest react-monorepo --preset=react-monorepo;
options selected:
cd react-monorepo;
Create ui library: nx g @nx/react:library ui --directory=libs/ui --js;
options selected:
nx add @nx/storybook;
nx g @nx/storybook:configuration ui --js --uiFramework=@storybook/react-vite;
NX Unable to create nodes for libs/ui/.storybook/main.js using plugin @nx/storybook/plugin.
Inner Error: TypeError: Cannot read properties of undefined (reading 'parent')
at traverse (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/traverse.js:45:38)
at traverseChildren (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/traverse.js:30:5)
at match (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/match.js:12:37)
at Function.query (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@phenomnomnominal/tsquery/dist/src/query.js:12:30)
at getStorybookConfig (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:169:60)
at buildStorybookTargets (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:68:32)
at exports.createNodes (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/@nx/storybook/src/plugins/plugin.js:52:15)
at buildProjectsConfigurationsFromProjectPathsAndPlugins (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/project-configuration-utils.js:148:29)
at createProjectConfigurations (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:156)
at _retrieveProjectConfigurations (/Users/joaoantunes/Lab/product/monorepo/example-js/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:61:12)
Current Behavior
I have just started a new nx workspace from scratch using react and vite. I have added some simple libraries with some ui components and everything works as expected.
Now I was trying to add storybook to one of those libraries following the documentation here.
After executing:
Storybook configurations on project and
nx.json
seems to be well generated but when I executed:I have the following error:
I am using version
18.0.5
of nx. Some ofnx
andstorybook
libraries on mypackage.json
:I could not find anything about this error. It seems to be internal and while trying to execute storybook plugin. It seems that
main.js
is not even executed because I have tried some changes on it and the error was always the same.Expected Behavior
Storybook to start for selected project.
GitHub Repo
No response
Steps to Reproduce
npx create-nx-workspace@latest react-monorepo --preset=react-monorepo
;options selected:
cd react-monorepo
;nx g @nx/react:library ui --directory=libs/ui --js
;options selected:
nx add @nx/storybook
;nx g @nx/storybook:configuration ui --js --uiFramework=@storybook/react-vite
;options selected:
nx run ui:storybook
;Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response