Skip to content
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

Error while executing nx run project-name:storybook #22042

Closed
1 of 4 tasks
joaoantunes87 opened this issue Feb 28, 2024 · 1 comment · Fixed by #22081
Closed
1 of 4 tasks

Error while executing nx run project-name:storybook #22042

joaoantunes87 opened this issue Feb 28, 2024 · 1 comment · Fixed by #22081
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug

Comments

@joaoantunes87
Copy link

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:

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:

    "@nx/eslint": "18.0.5",
    "@nx/eslint-plugin": "18.0.5",
    "@nx/jest": "18.0.5",
    "@nx/js": "18.0.5",
    "@nx/react": "18.0.5",
    "@nx/rollup": "18.0.5",
    "@nx/storybook": "18.0.5",
    "@nx/vite": "18.0.5",
    "@nx/web": "18.0.5",
    "@nx/workspace": "18.0.5",
    "@rollup/plugin-url": "^7.0.0",
    "@storybook/addon-essentials": "7.6.17",
    "@storybook/addon-interactions": "^7.5.3",
    "@storybook/core-server": "7.6.17",
    "@storybook/jest": "^0.2.3",
    "@storybook/react-vite": "7.6.17",
    "@storybook/test-runner": "^0.13.0",
    "@storybook/testing-library": "^0.2.2",

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

  1. Create a new nx workspace (integrated monorepo) with react-vite, e.g npx create-nx-workspace@latest react-monorepo --preset=react-monorepo;

options selected:
imagem

  1. cd react-monorepo;
  2. Create ui library: nx g @nx/react:library ui --directory=libs/ui --js;

options selected:

imagem

  1. nx add @nx/storybook;
  2. nx g @nx/storybook:configuration ui --js --uiFramework=@storybook/react-vite;

options selected:
imagem

  1. nx run ui:storybook;

Nx Report

Node   : 20.10.0
OS     : darwin-arm64
npm    : 10.2.3

nx                 : 18.0.5
@nx/js             : 18.0.5
@nx/linter         : 18.0.5
@nx/eslint         : 18.0.5
@nx/workspace      : 18.0.5
@nx/devkit         : 18.0.5
@nx/eslint-plugin  : 18.0.5
@nx/react          : 18.0.5
@nrwl/tao          : 18.0.5
@nx/vite           : 18.0.5
@nx/web            : 18.0.5
typescript         : 5.3.3

Failure Logs

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)

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Copy link

github-actions bot commented Apr 1, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants