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

[8.0.0]Cannot read properties of undefined (reading '__STORYBOOK__') #538

Closed
baixiaoyu2997 opened this issue Apr 16, 2024 · 12 comments · Fixed by #539
Closed

[8.0.0]Cannot read properties of undefined (reading '__STORYBOOK__') #538

baixiaoyu2997 opened this issue Apr 16, 2024 · 12 comments · Fixed by #539

Comments

@baixiaoyu2997
Copy link
Contributor

baixiaoyu2997 commented Apr 16, 2024

error log:

=> Failed to build the preview
TypeError: Cannot read properties of undefined (reading '__STORYBOOK__')
    at setup (file:///Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@nuxtjs+storybook@8.0.0_@types+node@18.19.17_eslint@8.57.0_nuxt@3.11.1_react-dom@18.2.0_react_eelvpxrgnep26wtslernja6ivm/node_modules/@nuxtjs/storybook/dist/module.mjs:122:25)
    at normalizedModule (file:///Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@nuxt+kit@3.11.2_rollup@4.14.1/node_modules/@nuxt/kit/dist/index.mjs:2112:37)
    at async installModule (file:///Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@nuxt+kit@3.11.1_rollup@4.14.1/node_modules/@nuxt/kit/dist/index.mjs:2415:95)
    at async initNuxt (file:///Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/nuxt@3.11.1_@types+node@18.19.17_@unocss+reset@0.59.0_eslint@8.57.0_floating-vue@5.2.2_rollup_g2d3cdn5gg3ikehhjhkd63jvqa/node_modules/nuxt/dist/index.mjs:4171:7)
    at async defineNuxtConfig (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@storybook-vue+nuxt@0.2.6_@types+node@18.19.17_eslint@8.57.0_nuxt@3.11.1_react-dom@18.2.0_rea_iyoqj7mfen6vrnvfyql4jszn6u/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6744:3)
    at async Object.viteFinal (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@storybook-vue+nuxt@0.2.6_@types+node@18.19.17_eslint@8.57.0_nuxt@3.11.1_react-dom@18.2.0_rea_iyoqj7mfen6vrnvfyql4jszn6u/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6773:22)
    at async createViteServer (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@storybook+builder-vite@8.0.8_typescript@5.4.5_vite@5.2.8/node_modules/@storybook/builder-vite/dist/index.js:55:11505)
    at async Module.start (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/@storybook+builder-vite@8.0.8_typescript@5.4.5_vite@5.2.8/node_modules/@storybook/builder-vite/dist/index.js:58:1102)

deps:

"devDependencies": {
    "@chromatic-com/storybook": "^1.3.3",
    "@nuxtjs/storybook": "^8.0.0",
    "@nuxt/kit": "^3.11.2",
    "@storybook-vue/nuxt": "^0.2.6",
    "@storybook/addon-essentials": "^8.0.8",
    "@storybook/addon-interactions": "^8.0.8",
    "@storybook/addon-links": "^8.0.8",
    "@storybook/blocks": "^8.0.8",
    "@storybook/builder-vite": "^8.0.8",
    "@types/fs-extra": "^11.0.4",
    "storybook": "^8.0.8",
    "storybook-addon-vue-slots": "^0.9.29"
  }

image

i think problem are here:
image

@9mm
Copy link

9mm commented Apr 16, 2024

I'm also getting this, and when i run this npx storybook-nuxt init in the docs it just reverts everything to v7

@matthew-dean
Copy link

This is closed as completed, but this issue occurs to me after upgrading to v8.0.0. I assume that means it is not released yet?

@jimmiejackson414
Copy link

^ Same. I know it's generally not kosher to follow up on closed issues, but I keep having to go into node_modules/@nuxtjs/storybook/dist/module.mjs to edit the import.meta.env.__STORYBOOK__ issue, which prevents me from merging this branch up.

@tobiasdiez
Copy link
Collaborator

It's indeed not yet released. In the meantime, you can just use the github repo as the source for the nuxtjs/storybook dependency and it should work (https://pnpm.io/cli/add#install-from-git-repository).

@kesoji
Copy link

kesoji commented May 2, 2024

you can just use the github repo as the source for the nuxtjs/storybook dependency and it should work

nuxtjs/storybook didn't work for me. Instead pnpm add -D nuxt-modules/storybook worked! Thank you.

@Paul-Hebert
Copy link

I'm having trouble using the GitHub repo as my import source. I ran the following command:

npm i -D github:nuxt-modules/storybook

It ran successfully. My package.json was updated:

image

And I can see the package in node_modules:

image

However, I get an error when I try to run the app:

Cannot find module '/Users/paulhebert/repos/repo-name-redacted/@nuxtjs/storybook'
Require stack:
- /Users/paulhebert/repos/repo-name-redacted/index.js

  Require stack:
  - index.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
  at Function.resolve (node:internal/modules/helpers:136:19)
  at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:251148)
  at resolveModule (node_modules/@nuxt/kit/dist/index.mjs:2210:29)
  at requireModule (node_modules/@nuxt/kit/dist/index.mjs:2215:24)
  at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2451:92)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2407:47)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:4023:7)
  at async NuxtDevServer._load (node_modules/nuxi/dist/chunks/dev2.mjs:6879:5)
  at async NuxtDevServer.load (node_modules/nuxi/dist/chunks/dev2.mjs:6811:7)

Any tips to get this working? I'll report back if I figure it out. Thanks!

@Paul-Hebert
Copy link

By the way, is there any timeline for releasing this fix? That would help me to know how to prioritize finding a workaround. Thanks!

@jimmiejackson414
Copy link

I'm still having this issue as well. I know all of these have been closed as duplicates, but would love to know when we might expect this very simple fix to be out.
Thanks for the otherwise great module and all the work put into it!

@tobiasdiez
Copy link
Collaborator

Sorry guys, we are still figuring out our release/development schedule. Stay tuned.

@bsiguret
Copy link

bsiguret commented May 22, 2024

Hello @tobiasdiez! I tried to install Storybook for our nuxt3 app but I encountered this bug right away. Do you still not have any ETA on when you're going to release the fix for it that was merged one month ago? Thanks!

I tried with yarn v4 to use the repo as a source for the package without success. I guess it has something to do with pnpm

yarn add -D @nuxtjs/storybook@github:nuxt-modules/storybook

Error: @nuxtjs/storybook@https://github.com/nuxt-modules/storybook.git#commit=30cb7036f1bfc5bc50b11b6b7c3857bcf23886b6: Assertion failed: Unsupported workflow

@tobiasdiez
Copy link
Collaborator

@chakAs3 could you please release a new version?

@Maxime-Asphalte
Copy link

Hello,

When will it be released ? It's quite durty to get the direct repository and it forces me to use pnpm instead of bun...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants