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

[Bug] Cannot read property 'createExpressionStatement' of undefined #496

Open
davisuga-h opened this issue Sep 15, 2022 · 3 comments
Open
Labels
awaiting clarification Information needed from reporter bug Something isn't working

Comments

@davisuga-h
Copy link

What version of vite are you using?

3.1.1

System info and storybook versions

System:
OS: Linux Mint 20.3 una
npmPackages:
"@storybook/addon-actions": "^6.5.12",
"@storybook/addon-essentials": "^6.5.12",
"@storybook/addon-interactions": "^6.5.12",
"@storybook/addon-links": "^6.5.12",
"@storybook/builder-vite": "^0.2.2",
"@storybook/react": "^6.5.12"
Binaries:
Node: v14.18.1
Yarn: 1.22.17
npm: 8.16.0
Browser:
Google Chrome

Describe the Bug

When I run yarn storybook, I get the following error:

Cannot read property 'createExpressionStatement' of undefined
Cannot read property 'createExpressionStatement' of undefined (x2)
10:30:38 AM [vite] Internal server error: Cannot read property 'createExpressionStatement' of undefined
  Plugin: vite:react-docgen-typescript
  File: /home/davi/work/harmonize-portal/apps/dashboard/src/Common/components/SupaTable/SupaTable.tsx
      at setDisplayName (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:53:62)
      at /home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:101:30
      at Array.map (<anonymous>)
      at generateDocgenCodeBlock (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:100:44)
      at TransformContext.transform (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:182:14)
      at Object.transform (file:///home/davi/work/harmonize-portal/node_modules/vite/dist/node/chunks/dep-a713b95d.js:41088:44)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async loadAndTransform (file:///home/davi/work/harmonize-portal/node_modules/vite/dist/node/chunks/dep-a713b95d.js:37349:29)
10:30:38 AM [vite] Internal server error: Cannot read property 'createExpressionStatement' of undefined
  Plugin: vite:react-docgen-typescript
  File: /home/davi/work/harmonize-portal/apps/dashboard/src/Questionnaire/components/QuestionnaireAlertChart/makePROTableDefinitions.tsx
      at setDisplayName (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:53:62)
      at /home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:101:30
      at Array.map (<anonymous>)
      at generateDocgenCodeBlock (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:100:44)
      at TransformContext.transform (/home/davi/work/harmonize-portal/node_modules/@joshwooding/vite-plugin-react-docgen-typescript/dist/index.cjs:182:14)
      at Object.transform (file:///home/davi/work/harmonize-portal/node_modules/vite/dist/node/chunks/dep-a713b95d.js:41088:44)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async loadAndTransform (file:///home/davi/work/harmonize-portal/node_modules/vite/dist/node/chunks/dep-a713b95d.js:37349:29)
      ```

### Link to Minimal Reproducible Example

_No response_

### Participation

- [ ] I am willing to submit a pull request for this issue.
@davisuga-h davisuga-h added the bug Something isn't working label Sep 15, 2022
@IanVS
Copy link
Member

IanVS commented Sep 15, 2022

@davisuga-h thanks for the report. Are you able to narrow down which component this is happening in, and share that component here? It seems that react-docgen-typescript isn't able to find a display name for the component.

@IanVS IanVS added the awaiting clarification Information needed from reporter label Sep 15, 2022
@abhinavramkumar
Copy link

@davisuga-h Could you try upgrading your typescript version to the latest and run storybook. I was facing the same issue and this resolved it for me.

TS version that I'm using is 4.8.4
I also changed the extension of main.js and preview.js in the .storybook directory to ".ts"

Hope this helps. Cheers!

@AlexcastroDev
Copy link

@davisuga-h Could you try upgrading your typescript version to the latest and run storybook. I was facing the same issue and this resolved it for me.

TS version that I'm using is 4.8.4 I also changed the extension of main.js and preview.js in the .storybook directory to ".ts"

Hope this helps. Cheers!

Thanks, it works for me also.

I am working with Monorepo, so i changed the storybook from main package to each project, and forget to add the typescript on package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting clarification Information needed from reporter bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants