nuxt-modules / storybook

Storybook integration with Nuxt.
https://storybook.nuxtjs.org
378 stars 82 forks source link

Cannot read properties of undefined (reading 'STORYBOOK') #637

Closed RBlanchet closed 3 weeks ago

RBlanchet commented 3 weeks ago

Hello 🙌,

I am encountering an issue with the Storybook module in a newly created fresh Nuxt project.

Steps to Reproduce:

  1. Create a new Nuxt project (actually 3.11.2) using the command: npx nuxi@latest init test-nuxt
  2. Add the Storybook module version 8.0.0 using: npx nuxi@latest module add storybook
  3. Run the development server with: yarn run dev

Error

When running the development server, the following error is displayed

Cannot start nuxt:  Cannot read properties of undefined (reading '__STORYBOOK__') 

Workaround:

Manually changing the property import.meta.env to process.env in the module.mjs file resolves the issue and the application runs successfully.

It seems to be potentially linked to this development https://github.com/nuxt-modules/storybook/pull/512 in module 8.0.0

Could you please provide guidance on how to resolve this issue without manually modifying the module file?

Thank you for your support !

sifferhans commented 3 weeks ago

This is a duplicate of #538 I think 😁

seancrater commented 3 weeks ago

I'm having this issue as well

mehcode commented 3 weeks ago

I think we're all waiting on a patch release of the module. 🙏 @chakAs3

jimmiejackson414 commented 3 weeks ago

^ It's been happening since the v8.0.0 release from 2 months ago.

mehcode commented 3 weeks ago

It works if you use the git sha in your package.json but pre-pack is then failing in github actions for me, so going to look at another option.

seancrater commented 3 weeks ago

I can't seem to get the suggested workaround to work with Yarn either

mehcode commented 3 weeks ago

@seancrater et all, I pushed a git dep that's pre-built here - github:mehcode/storybook#bundle, I find that some times the all the bundling makes git deps fail

This dep in my devDependencies makes it work for me:

"@nuxtjs/storybook": "github:mehcode/storybook#bundle",