Skip to content

[CLI]: install-browser --no-shell is rejected with "Unknown option: --shell" #42804

Closed

Description

playwright-cli install-browser advertises --no-shell in its own --help, but passing it
fails with Unknown option: --shell and exit code 1. Reproduced on the latest release, 0.1.21.
Because every spelling is rejected, there is currently no supported way to install Chromium
through playwright-cli without also downloading chromium-headless-shell — which is exactly
what the flag is for. That is an extra ~261 MB on disk for a setup that only ever runs headed.

The sibling flag --only-shell, on the same command, is accepted — so the failure is specific to
the negated form, not to install-browser.

Reproduction (uses --dry-run, so nothing is downloaded):

npx @playwright/[email protected] install-browser chromium --dry-run     # lists Chrome Headless Shell
npx @playwright/[email protected] install-browser chromium --no-shell --dry-run

Expected: --no-shell is accepted and Chromium is installed without
chromium-headless-shell, matching the help text and npx playwright install chromium --no-shell.

Actual:

$ npx @playwright/[email protected] install-browser chromium --no-shell --dry-run
Unknown option: --shell
(exit 1)

The option is listed by the command itself:

$ npx @playwright/[email protected] install-browser --help
Options:
  --only-shell                only install headless shell when installing chromium
  --no-shell                  do not install chromium headless shell

A plain --dry-run confirms the shell is part of a Chromium install:

$ npx @playwright/[email protected] install-browser chromium --dry-run
Chrome for Testing 154.0.8037.0 (playwright chromium v1246)
FFmpeg (playwright ffmpeg v1011)
Chrome Headless Shell 154.0.8037.0 (playwright chromium-headless-shell v1246)

Every spelling tried on 0.1.21, each exiting 1:

Argument Output
--no-shell Unknown option: --shell
--shell=false Unknown option: --shell
--noShell Unknown option: --noShell
--no-shell=true uncaught exception (below)
--only-shell accepted, exit 0
$ npx @playwright/[email protected] install-browser chromium --no-shell=true --dry-run
<prefix>/playwright-core/lib/tools/cli-client/minimist.js:56
        throw new Error(`boolean option '--${key}' should not be passed with '=value', use '--${key}' or '--no-${key}' instead`);
              ^

Error: boolean option '--no-shell' should not be passed with '=value', use '--no-shell' or '--no-no-shell' instead
    at minimist (<prefix>/playwright-core/lib/tools/cli-client/minimist.js:56:15)
    at program (<prefix>/playwright-core/lib/tools/cli-client/program.js:64:45)
    at main (<prefix>/@playwright/cli/playwright-cli.js:36:3)

That message recommends --no-shell, the spelling that fails, and surfaces as an unhandled stack
trace rather than a CLI error.

Likely cause. Both pieces are present on current main, which matches the behaviour being
identical on 0.1.19 and 0.1.21:

  • packages/playwright-core/src/tools/cli-daemon/commands.ts declares the option under the
    literal key ['no-shell'].
  • packages/playwright-core/src/tools/cli-client/minimist.ts rewrites any --no-<x> argument to
    key <x> with value false, so --no-shell arrives as the key shell.
  • Validation finds no declared shell option and reports it — the observed Unknown option: --shell. --only-shell is unaffected because its name carries no no- prefix.

Environment: @playwright/cli 0.1.21 (bundling playwright-core
1.64.0-alpha-1789764292000), run via npx. Also reproduced identically on 0.1.19 installed
globally. Linux (Arch-based), kernel 7.2.6, x86_64, Node v26.8.2.

Related, not duplicates:

Workaround — skip the call when the browser is already installed, so the shell is not pulled
in on repeat runs:

compgen -G "$PLAYWRIGHT_BROWSERS_PATH/chromium-*" >/dev/null ||
  playwright-cli install-browser chromium

Activity

  1. VolodymyrLinuxovich commented on Sep 20, 2026

    @VolodymyrLinuxovich

    I reproduced this on current main and have a focused fix with a regression test ready. The CLI parser treats --no-shell as negating shell, although install-browser declares a literal no-shell boolean option. The change recognizes declared no-* flags while preserving ordinary negation such as --no-verbose.

    The dry-run CLI test passes and confirms Chromium is listed without Chrome Headless Shell. The build, TypeScript check, and ESLint check also pass. The tested branch is at https://github.com/VolodymyrLinuxovich/playwright/tree/fix/cli-install-browser-no-shell. Could a maintainer approve this for community contribution or assign #42804 to me? I can open the PR after approval, as requested in CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions