storybookjs/storybook

[Bug]: Error handling for Vite 2.x

Open

#21,313 opened on Mar 1, 2023

View on GitHub
 (0 comments) (1 reaction) (0 assignees)TypeScript (10,058 forks)batch import
builder-vitehas workaroundhelp wantedmaintenance

Repository metrics

Stars
 (89,909 stars)
PR merge metrics
 (Avg merge 7d 22h) (184 merged PRs in 30d)

Description

Describe the bug

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @inkline/inkline@3.1.9
npm ERR! Found: vite@2.9.15
npm ERR! node_modules/vite
npm ERR! dev vite@"^2.9.14" from the root project
npm ERR! peer vite@"2.x || 3.x || 4.x" from @preact/preset-vite@2.5.0
npm ERR! node_modules/@preact/preset-vite
npm ERR! peerOptional @preact/preset-vite@"*" from @storybook/builder-vite@7.0.0-beta.55
npm ERR! node_modules/@storybook/builder-vite
npm ERR! dev @storybook/builder-vite@"^7.0.0-beta.55" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0 || ^4.0.0" from @storybook/builder-vite@7.0.0-beta.55
npm ERR! node_modules/@storybook/builder-vite
npm ERR! dev @storybook/builder-vite@"^7.0.0-beta.55" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/tom/.npm/eresolve-report.txt for a full report.

The issue here is the that the project depends on vite@^2.9.14, which isn’t supported by builder-vite.

  • Catch this error and make a more useful error message
  • Document this limitation in the migration guide

Workaround

I then ran npm add vite@^4 @vitejs/plugin-vue@^4 before upgrading, and it went through fine.

To Reproduce

https://github.com/inkline/inkline

System

No response

Additional context

No response

Contributor guide