Skip to content

[Bug]: Storybook cannot be installed in a Stackblitz or Bolt.new environment #32117

@valentinpalkovic

Description

@valentinpalkovic

Describe the bug

When attempting to install Storybook on StackBlitz or Bolt.new, @storybook/addon-vitest tries to install playwright, which hangs with the following error message:

› Configuring Playwright with Chromium (this might take some time):
  npx playwright install chromium --with-deps
Error running postinstall script for @storybook/addon-vitest
Error: Command failed with exit code 1: npx playwright install chromium --with-deps
BEWARE: your OS is not officially supported by Playwright; installing dependencies for ubuntu20.04-x64 as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
Failed to install browsers
Error: spawn su ENOENT
    at makeError (/home/projects/vitejs-vite-9hr4xbcr/node_modules/storybook/dist/common/index.cjs:24517:67)
    at handlePromise (/home/projects/vitejs-vite-9hr4xbcr/node_modules/storybook/dist/common/index.cjs:25135:15)
    at async postInstall (/home/projects/vitejs-vite-9hr4xbcr/node_modules/@storybook/addon-vitest/dist/postinstall.js:94:896)
    at async postinstallAddon (/home/.npm/_npx/e735b42ccbe56908/node_modules/@storybook/cli/dist/bin/index.cjs:83:873)
    at async add (/home/.npm/_npx/e735b42ccbe56908/node_modules/@storybook/cli/dist/bin/index.cjs:85:2082) {
  shortMessage: 'Command failed with exit code 1: npx playwright install chromium --with-deps',
  command: 'npx playwright install chromium --with-deps',
  escapedCommand: '"npx playwright install chromium --with-deps"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: 'Installing dependencies...\n' +
    'Switching to root user to install dependencies...\n' +
    'Failed to install browsers\n' +
    'Error: spawn su ENOENT',
  stderr: 'BEWARE: your OS is not officially supported by Playwright; installing dependencies for ubuntu20.04-x64 as a fallback.',
  cwd: '/home/projects/vitejs-vite-9hr4xbcr',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Proposed solution

The installation of playwright should be skipped in unsupported environments.

Reproduction link

https://stackblitz.com/edit/vitejs-vite-9hr4xbcr

Reproduction steps

  1. Go to https://stackblitz.com/ and create a new React project
  2. Init Storybook via npx storybook@latest init --yes

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Needs Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions