storybook: [Bug]: `7.0.0-rc.-3` breaks vite + pnpm support - Error: Cannot find module `@storybook/builder-vite`

Describe the bug

Regression when updating from 7.0.0-rc.1 to 7.0.0-rc.3 leading to

Error: Cannot find module ‘@storybook/builder-vite

To Reproduce

(I use pnpm)

Clone Reproduction and Checkout 839aabc

git clone git@github.com:D1no/reproduction-storybook-symlinks-pnpm.git && cd reproduction-storybook-symlinks-pnpm && git checkout 839aabc

Update Storybook with

cd tools && pnpx storybook@next upgrade --prerelease --skip-check

Result:

➜  tools git:(master) ✗ pnpm run storybook                                   

> tools@ storybook /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools
> storybook dev -p 6006

@storybook/cli v7.0.0-rc.3

ERR! Error: Cannot find module '@storybook/builder-vite'
ERR! Require stack:
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/bin/index.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/storybook@7.0.0-rc.3/node_modules/storybook/index.js
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
ERR!     at Function.resolve (node:internal/modules/cjs/helpers:116:19)
ERR!     at getPreviewBuilder (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:10:1789)
ERR!     at buildDevStandalone (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:40:2022)
ERR!     at async withTelemetry (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:27:3469)
ERR!     at async dev (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js:446:400)
ERR!     at async Command.<anonymous> (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js:448:327)
ERR!  Error: Cannot find module '@storybook/builder-vite'
ERR! Require stack:
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/bin/index.js
ERR! - /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/storybook@7.0.0-rc.3/node_modules/storybook/index.js
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
ERR!     at Function.resolve (node:internal/modules/cjs/helpers:116:19)
ERR!     at getPreviewBuilder (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:10:1789)
ERR!     at buildDevStandalone (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:40:2022)
ERR!     at async withTelemetry (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js:27:3469)
ERR!     at async dev (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js:446:400)
ERR!     at async Command.<anonymous> (/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js:448:327) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     '/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+core-server@7.0.0-rc.3/node_modules/@storybook/core-server/dist/index.js',
ERR!     '/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/dist/generate.js',
ERR!     '/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/@storybook+cli@7.0.0-rc.3/node_modules/@storybook/cli/bin/index.js',
ERR!     '/Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/node_modules/.pnpm/storybook@7.0.0-rc.3/node_modules/storybook/index.js'
ERR!   ]
ERR! }

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

✔ Would you like to help improve Storybook by sending anonymous crash reports? … yes
 ELIFECYCLE  Command failed with exit code 1.

System

Environment Info:

  System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 18.14.1 - ~/.nvs/default/bin/node
    npm: 9.3.1 - ~/.nvs/default/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 97.0.1
    Safari: 16.3
  npmPackages:
    @storybook/addon-essentials: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/addon-interactions: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/addon-links: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/blocks: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/react: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/react-vite: ^7.0.0-rc.1 => 7.0.0-rc.1 
    @storybook/testing-library: ^0.0.14-next.1 => 0.0.14-next.1

Additional context

_Originally posted by @D1no in https://github.com/storybookjs/storybook/issues/21399#issuecomment-1469048323_

About this issue

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

Commits related to this issue

Most upvoted comments

Well @IanVS, no JSDocs (https://github.com/D1no/reproduction-storybook-symlinks-pnpm), recursive inclusion of node_modules which can not be anti globbed (https://github.com/storybookjs/storybook/issues/11181#issuecomment-1455449562), some other issues I forgot about now