Skip to content

[Bug]: Storybook init can require sudo because of Playwright install #32043

@JReinhold

Description

@JReinhold

Describe the bug

When initting Storybook and getting addon-vitest, the addon's postinstall installs Playwright with dependencies:

await packageManager.executeCommand({
command: 'npx',
args: ['playwright', 'install', 'chromium', '--with-deps'],
});

This can lead to the terminal require sudo, because that can be necessary to install the browser dependencies. This requirement can scare some users off, because they are not just giving sudo to the playwright install, but to the whole init process, which is opaque to the user and less secure.

Additional context

Originally reported by @dominikg. I have not myself been able to reproduce this, it seems like Playwright refuses to install browsers on my machine, relying on some cached installs that I can't remove.

This the log shown:

› Configuring Playwright with Chromium (this might take some time):
  npx playwright install chromium --with-deps
[sudo] password for USER: 

If we don't add --with-deps it just downloads the binaries without using sudo. The deps are usually present from the system installed chromium and managed by the packaging system of the linux distro. It can lead to issues if the system installed chromium has deps that are incompatible from the one playwright wants to use, but that might not be an issue in practice.

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions