[Bug] Failed to resolve import "@storybook/preview-web"
See original GitHub issueWhat version of vite
are you using?
3.2.2
System info and storybook versions
Windows 11. Storybook 6.5.13. Node 16.10.0 x64. Yarn 3.2.4
Describe the Bug
I did a fresh install of storybook using npx storybook init --builder @storybook/builder-vite
.
I then ran start-storybook -p 6006
. The address opens in my browser and I get the following error:
[plugin:vite:import-analysis] Failed to resolve import "@storybook/preview-web" from "..\..\..\..\..\virtual:\@storybook\builder-vite\vite-app.js". Does the file exist?
/virtual:/@storybook/builder-vite/vite-app.js:1:45
1 | import { composeConfigs, PreviewWeb } from '@storybook/preview-web';
| ^
2 | import { ClientApi } from '@storybook/client-api';
3 | import '/virtual:/@storybook/builder-vite/setup-addons.js';
at formatError (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual-f948f15dbd/0/cache/vite-npm-3.2.2-b6065be34d-7197ac91c6.zip/node_modules/vite/dist/node/chunks/dep-c842e491.js:41168:46)
at TransformContext.error (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual-f948f15dbd/0/cache/vite-npm-3.2.2-b6065be34d-7197ac91c6.zip/node_modules/vite/dist/node/chunks/dep-c842e491.js:41164:19)
at normalizeUrl (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual-f948f15dbd/0/cache/vite-npm-3.2.2-b6065be34d-7197ac91c6.zip/node_modules/vite/dist/node/chunks/dep-c842e491.js:38032:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async TransformContext.transform (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual-f948f15dbd/0/cache/vite-npm-3.2.2-b6065be34d-7197ac91c6.zip/node_modules/vite/dist/node/chunks/dep-c842e491.js:38165:47)
at async Object.transform (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual-f948f15dbd/0/cache/vite-npm-3.2.2-b6065be34d-7197ac91c6.zip/node_modules/vite/dist/node/chunks/dep-c842e491.js:41421:30)
at async loadAndTransform (file:///C:/Users/mbotsko/Desktop/Emprise/sammweb-v3/.yarn/__virtual__/vite-virtual
Link to Minimal Reproducible Example
No response
Participation
- I am willing to submit a pull request for this issue.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Error: Cannot find module '@storybook/preview-web/package ...
I dug into the node_modules/@storybook folder, and indeed, preview-web was not there. So, I manually copied the preview-web folder from another ...
Read more >@storybook/preview-web | Yarn - Package Manager
This is the main API for the (web) version of the Storybook Preview. storybook. readme. Storybook. Build bulletproof UI components faster. Build Status...
Read more >rollup failed to resolve import "react-dom/client" - You.com
If you do want to externalize this module explicitly add it to `build.rollupOptions.external` ERR! Error: [vite]: Rollup failed to resolve import "{}" from...
Read more >Storybook failing to build with PNPM workspaces and Vite ...
When running a storybook with Vite in a pnpm workspace I see this error [vite] Internal server error: Failed to resolve import "@storybook/preview-web"...
Read more >vue.js - Storybook stuck on loading with Vue3 and pnpm
I'm trying to run Storybook with Vue3 and pnpm. ... [vite] Internal server error: Failed to resolve import "@storybook/client-api" from ".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I appended the stack trace to my last comment in case that helps you. I really appreciate your time. I’ll close this as solved and I look forward to v7.
A decade ago, when we started the last major web project, I setup a bunch of isolated html pages with our design components. We’re now starting a fresh project with react/ts etc and I’m so pleased storybook exists, it’s what I did but 10x better.
Yes, it still happens even after I remove that line from main.cjs.
Here’s the full stack: