Fresh install results in error
Environment
- Operating System: Darwin
- Node Version: v23.6.0
- Nuxt Version: 3.15.2
- CLI Version: 3.20.0
- Nitro Version: 2.10.4
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools, modules
- Runtime Modules: @nuxtjs/[email protected]
- Build Modules: -
Reproduction
https://stackblitz.com/edit/github-qzue1bhu?file=.storybook%2Fmain.ts
Describe the bug
@storybook/core v8.5.0
SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook/main.ts file.
Original error:
ReferenceError: require is not defined
at getAbsolutePath (/.storybook/main.ts:10:18)
at /.storybook/main.ts:15:5
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:396:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:363:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1569:24)
at Module._compile (node:internal/modules/cjs/loader:1721:5)
at Object.loadTS [as .ts] (node:internal/modules/cjs/loader:1831:10)
at Module.load (node:internal/modules/cjs/loader:1473:32)
at Function._load (node:internal/modules/cjs/loader:1285:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at loadMainConfig (/Users/maciej.jezierski/projects/FiskarsGroup_CoreLibrary/node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/core/dist/common/index.cjs:17550:11)
at async buildDevStandalone (/Users/maciej.jezierski/projects/FiskarsGroup_CoreLibrary/node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:37127:11)
at async withTelemetry (/Users/maciej.jezierski/projects/FiskarsGroup_CoreLibrary/node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:35750:12)
at async dev (/Users/maciej.jezierski/projects/FiskarsGroup_CoreLibrary/node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/core/dist/cli/bin/index.cjs:2591:3)
at async s.
Additional context
All dependencies and proper configuration should be installed on fresh project
Does this still occur with the latest storybook version?
Yes, it does. I'm using Nuxt 3.17.2 and Storybook 8.16.2 and although the process tries to start for couple of seconds - it fails right away
Any update? i have the same issue
I can give some insights as well (using npm, Nuxt 3):
- When following the instructions (
npx nuxi@latest module add storybookand updating nuxt.config.ts), I don't see any new directories (like.storybook) appear (install was successful). - When adding that manually, including a config file, it can't find either
@storybook/nuxt, or@nuxt/stroybookAlso, apparently there's a video showing instructions, but I can't find it? (Zero configuration to start (see video))
Edit:
After digging through the repo, I see an example main.ts config file that actually works (why doesn't the module set this up? 🤔 )
But after running, there's issues with server imports (no idea why, I don't do server imports in the directory I have configured).