storybook: [Bug]: Storybook couldn't evaluate your
Describe the bug
when I try to run it gives an error:
SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook\main.ts file.
Original error:
Error: Transform failed with 1 error:
(define name):1:0: ERROR: Expected identifier but found "import"
at failureErrorWithLog (\node_modules\esbuild\lib\main.js:1476:15)
at responseCallbacks.<computed> (\node_modules\esbuild\lib\main.js:622:9)
at Socket.readFromStdout (\node_modules\esbuild\lib\main.js:600:7)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
at loadMainConfig (.\node_modules\@storybook\core\dist\common\index.cjs:17511:11)
at async buildDevStandalone (.\node_modules\@storybook\core\dist\core-server\index.cjs:37134:11)
at async withTelemetry (.\node_modules\@storybook\core\dist\core-server\index.cjs:35757:12)
at async dev (.\node_modules\@storybook\core\dist\cli\bin\index.cjs:2591:3)
at async s.<anonymous> (.\node_modules\@storybook\core\dist\cli\bin\index.cjs:2643:74)
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
I use next js version 14 I found answers for Vite but couldn’t find one that suited me
Reproduction link
Reproduction steps
No response
System
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 AMD Ryzen 5 2600X Six-Core Processor
Binaries:
Node: 22.0.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD <----- active
npm: 10.5.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (129.0.2792.89)
npmPackages:
@storybook/addon-essentials: 8.4.2 => 8.4.2
@storybook/addon-interactions: 8.4.2 => 8.4.2
@storybook/addon-onboarding: 8.4.2 => 8.4.2
@storybook/blocks: 8.4.2 => 8.4.2
@storybook/nextjs: ^8.4.2 => 8.4.7
@storybook/preview-api: ^8.4.2 => 8.4.7
@storybook/react: 8.4.2 => 8.4.2
@storybook/test: 8.4.2 => 8.4.2
eslint-plugin-storybook: ^0.11.0 => 0.11.1
storybook: 8.4.2 => 8.4.2
Additional context
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 16 (2 by maintainers)
Hello, in my case it was solved by reinstalling dependencies with version 20 of node
Storybook 9 getting
SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook/main.ts fileWhen running build. on Node 24.I’ve started getting the same SB_CORE-SERVER_0007 error, tried all the suggestion and can’t seem to find a way to get it working again.
@Redstoneguy129 had the same issue, in my case it was due to use of
requirethat is not defined in ES modules in Node 24. I rewroterequireto usecreateRequire.From:
To:
I got the same error code when upgrading from Storybook 8.4.7 to 8.5.0, although maybe for a different reason:
My fix:
Experiencing the same problem with Node 22.1.0 I Upgraded to Node 23.11.0, reinstalled dependencies, and it helped.
We are also getting the same issue while upgrading Sb from 7 to 8
I had similar issues, with the latest storybook and esbuild, also make sure you’re using
main.tsinstead ofmain.tsx. That was our issueI have this issue after deleting my lock file and reinstalling
** Disclaimer** This information might be inaccurate, due to it being generated automatically This error occurs because esbuild is unable to process the TypeScript imports in your .storybook/main.ts file. For Next.js 14, modify your .storybook/main.ts to use the following format:
Ensure you have
@storybook/nextjsinstalled and that your TypeScript configuration (tsconfig.json) includes the Storybook directory.About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Edit Issue Bot Settings · Greptile