storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
891 stars 107 forks source link

[Bug] Regression `pnpm` support broken, outdated peer dependencies #569

Closed D1no closed 1 year ago

D1no commented 1 year ago

Moved from: https://github.com/storybookjs/storybook/issues/21612

Just ran a repo i didn't run for a week, and apparently this is broken even in older version — worked without problems last week and build from a lock file. Pretty frustrating when dependencies are changed without versioning.

_tooling/storybook dev: @storybook/cli v7.0.0-beta.62
_tooling/storybook dev: ERR! Error: Cannot find module '@storybook/builder-vite'
_tooling/storybook dev: ERR! Require stack:
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/bin/index.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/storybook@7.0.0-beta.62/node_modules/storybook/index.js
_tooling/storybook dev: ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
_tooling/storybook dev: ERR!     at Function.resolve (node:internal/modules/cjs/helpers:116:19)
_tooling/storybook dev: ERR!     at getPreviewBuilder (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:10:1789)
_tooling/storybook dev: ERR!     at buildDevStandalone (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:40:2022)
_tooling/storybook dev: ERR!     at async withTelemetry (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:27:3469)
_tooling/storybook dev: ERR!     at async dev (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js:446:400)
_tooling/storybook dev: ERR!     at async Command.<anonymous> (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js:448:327)
_tooling/storybook dev: ERR!  Error: Cannot find module '@storybook/builder-vite'
_tooling/storybook dev: ERR! Require stack:
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/bin/index.js
_tooling/storybook dev: ERR! - /Users/worker/development/portfolio/platform/node_modules/.pnpm/storybook@7.0.0-beta.62/node_modules/storybook/index.js
_tooling/storybook dev: ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
_tooling/storybook dev: ERR!     at Function.resolve (node:internal/modules/cjs/helpers:116:19)
_tooling/storybook dev: ERR!     at getPreviewBuilder (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:10:1789)
_tooling/storybook dev: ERR!     at buildDevStandalone (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:40:2022)
_tooling/storybook dev: ERR!     at async withTelemetry (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js:27:3469)
_tooling/storybook dev: ERR!     at async dev (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js:446:400)
_tooling/storybook dev: ERR!     at async Command.<anonymous> (/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js:448:327) {
_tooling/storybook dev: ERR!   code: 'MODULE_NOT_FOUND',
_tooling/storybook dev: ERR!   requireStack: [
_tooling/storybook dev: ERR!     '/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+core-server@7.0.0-beta.62/node_modules/@storybook/core-server/dist/index.js',
_tooling/storybook dev: ERR!     '/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/dist/generate.js',
_tooling/storybook dev: ERR!     '/Users/worker/development/portfolio/platform/node_modules/.pnpm/@storybook+cli@7.0.0-beta.62/node_modules/@storybook/cli/bin/index.js',
_tooling/storybook dev: ERR!     '/Users/worker/development/portfolio/platform/node_modules/.pnpm/storybook@7.0.0-beta.62/node_modules/storybook/index.js'
_tooling/storybook dev: ERR!   ]
_tooling/storybook dev: ERR! }
_tooling/storybook dev: WARN Broken build, fix the error above.
_tooling/storybook dev: WARN You may need to refresh the browser.
_tooling/storybook dev: Failed
/Users/worker/development/portfolio/platform/_tooling/storybook:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @tooling/storybook@ dev: `storybook dev -p 6006 --ci --quiet`

Adding @storybook/builder-vite manually also reveals (once again) unmet peer dependencies due to including an old version of mdx-js. Which was originally fixed in https://github.com/storybookjs/storybook/issues/21396

storybook git:(trunk) pnpm install @storybook/builder-vite                                                
 WARN  deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
 WARN  deprecated trim@0.0.1: Use String.prototype.trim() instead
 WARN  deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
 WARN  deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
 WARN  deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
 WARN  deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
 WARN  deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
 WARN  deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
 WARN  deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
../..                                    | +377   -3 ++++++++++++++++++++++++++++++++++++++-
../..                                    | Progress: resolved 1364, reused 1322, downloaded 21, added 373, done
../../node_modules/.pnpm/core-js@3.29.1/node_modules/core-js: Running postinstall script, done in 40ms
../.. prepare$ cd .. && husky install platform/_tooling/.husky
│ husky - Git hooks installed
└─ Done in 322ms

dependencies:
+ @storybook/builder-vite 0.4.2

 WARN  Issues with peer dependencies found
_tooling/storybook
└─┬ @storybook/builder-vite 0.4.2
  └─┬ @storybook/mdx1-csf 1.0.0-next.0
    └─┬ @mdx-js/react 1.6.22
      └── ✕ unmet peer react@"^16.13.1 || ^17.0.0": found 18.2.0

The integrity of 3590 files was checked. This might have caused installation to take longer.
Done in 6.1s

Force updated the working project to @storybook/cli v7.0.0-rc.3 and added "@storybook/builder-vite": "^7.0.0-rc.3" to be able to use it (though mondays are usually update cycles). Oh well.

Originally posted by @D1no in https://github.com/storybookjs/storybook/issues/21612#issuecomment-1471902420

IanVS commented 1 year ago

Hi, the main storybook repo is the correct place for this issue, and I've responded there (this repo is for the vite-builder for storybook 6.4+).