storybook: [Bug]: [vite] Internal server error: Missing "./preview.js" specifier in "@storybook/react" package

Describe the bug

I am experiencing this error.

Using NX 16.5.0, storybook 7.0.26 commands done:

  1. npm install -D @nx/storybook
  2. nx g @nx/storybook:configuration {project_name}
  3. nx storybook {project_name}

in the network tab in developer console I see the call: http://localhost:4400/virtual:/@storybook/builder-vite/vite-app.js which returns 404 added test component is listed on the left side but endless loading circle is showed in the center: image

component doesn’t render at all.

any hints?

To Reproduce

No response

System

logs: 2:20:07 PM [vite] Internal server error: Missing "./preview.js" specifier in "@storybook/react" package Plugin: vite:import-analysis File: /virtual:/@storybook/builder-vite/vite-app.js at e (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:21424:25) at n (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:21424:627) at o (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:21424:1297) at resolveExportsOrImports (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:28705:20) at resolveDeepImport (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:28724:31) at tryNodeResolve (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:28415:20) at Context.resolveId (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:28176:28) at async Object.resolveId (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:44099:32) at async ModuleGraph._resolveUrl (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:64784:46) at async file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:64702:45 at async Promise.all (index 1) at async ModuleGraph.updateModuleInfo (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:64678:13) at async TransformContext.transform (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:42016:39) at async Object.transform (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:44175:30) at async loadAndTransform (file:///Users/kajurek/repo/bdb/frontend/bdb-monorepo/node_modules/vite/dist/node/chunks/dep-1d3a4915.js:54810:29) ^C%

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 13
  • Comments: 16 (1 by maintainers)

Most upvoted comments

This issue should be fixed in vite@4.4.1

I’m getting something similar but like this:

Missing "./dist/entry-preview.mjs" specifier in "@storybook/react" package

with vite 4.5.0, vite 5.0.4, vite 4.3.9 and vite 4.4.1

Our team confirmed the issue is something with our vite version. Downgrading to "vite": "~4.3.9" patched up the issue for now… (not the greatest solution ofcourse)

@kamiljurek . We are running into the same issue

Our team confirmed the issue is something with our vite version. Downgrading to "vite": "~4.3.9" patched up the issue for now… (not the greatest solution ofcourse)

Thx vite downgrade to 4.3 solved the issue for now. ❤️

Just wanted to add the same answer as marcovanharten-cpi. We have the same issue and vite 4.3.9 is working with that issue. so we can confirm the workaround

Update package @storybook/react to 7.6.9 helped fix this issue.

Storybook 7.6.7 fixes this 😃