grafana/k6 · error · ErrChromeNotInstalled

k6 couldn't detect google chrome or a chromium-supported…

Error message

k6 couldn't detect google chrome or a chromium-supported browser on this system

What it means

When k6 launches a local browser it looks for a Google Chrome or Chromium executable in standard locations (honoring K6_BROWSER_PATH); if none is found, ErrChromeNotInstalled (chromium/browser_type.go:345) aborts browser startup before any test code runs. This is an environment problem, not a script problem.

Solutions

  1. Install Google Chrome or Chromium on the host (apt-get install -y chromium, or the official Chrome package)
  2. Point k6 at an existing binary: K6_BROWSER_PATH=/usr/bin/chromium k6 run script.js (or the execPath browser option on recent versions)
  3. Use a remote browser instead: run a Chromium container and set K6_BROWSER_WS_URL to its webSocketDebuggerUrl
  4. Use a k6 image with a browser preinstalled (e.g. grafana/k6 with a Chromium layer, or mcr.microsoft.com/playwright/python with k6 added)

Example fix

# before
k6 run script.js  # -> k6 couldn't detect google chrome or a chromium-supported browser on this system

# after
apt-get update && apt-get install -y chromium
K6_BROWSER_PATH=/usr/bin/chromium k6 run script.js
Defensive patterns

Strategy: validation

Validate before calling

# fail fast before the test run
command -v google-chrome >/dev/null 2>&1 \
  || command -v google-chrome-stable >/dev/null 2>&1 \
  || command -v chromium >/dev/null 2>&1 \
  || command -v chromium-browser >/dev/null 2>&1 \
  || { echo 'no chrome/chromium found — install one or set K6_BROWSER_PATH / K6_BROWSER_WS_URL' >&2; exit 1; }
k6 run script.js

Prevention

When it happens

Trigger: Running browser tests on a host or container with no Chrome/Chromium installed: minimal Docker images (alpine/distroless/slim), bare CI runners without a browser step, freshly provisioned VMs, or a K6_BROWSER_PATH that is unset while no system-wide install exists.

Common situations: CI pipelines moving to slimmer images; running k6 on servers/containers without a GUI browser; new teammates on Linux distros where Chrome isn't preinstalled; using the plain grafana/k6 image and expecting a bundled browser.

Related errors


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/421fae4ba1a77f14. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/chromium/browser_type.go:345

) (_ *common.BrowserProcess, rerr error) {
	bProcCtx, bProcCtxCancel := context.WithCancelCause(ctx)
	defer func() {
		if rerr != nil {
			bProcCtxCancel(errors.New("local browser process init failed"))
		}
	}()

	args, err := parseArgs(flags)
	if err != nil {
		return nil, err
	}

	return common.NewLocalBrowserProcess(bProcCtx, path, args, dataDir, bProcCtxCancel, logger) //nolint: wrapcheck
}

var (
	// ErrChromeNotInstalled is returned when the Chrome executable is not found.
	ErrChromeNotInstalled = errors.New(
		"k6 couldn't detect google chrome or a chromium-supported browser on this system",
	)

	// ErrChromeNotFoundAtPath is returned when the Chrome executable is not found at the given path.
	ErrChromeNotFoundAtPath = errors.New(
		"k6 couldn't detect google chrome or a chromium-supported browser on the given path",
	)
)

// executablePath returns the path where the extension expects to find the browser executable.
func executablePath(
	path string,
	env env.LookupFunc,
	lookPath func(file string) (string, error), // os.LookPath
) (string, error) {
	// find the browser executable in the user provided path
	if path := strings.TrimSpace(path); path != "" {
		if _, err := lookPath(path); err == nil {

View on GitHub (pinned to 8d06114777)