Diagnosing Chrome-Launch Failures in Karma 6.x Test Suites
Karma exits with code 1 and Failed to launch Chrome. This diagnostic guide identifies the five common causesmissing binary sandbox blocks config mismatches proxy issues and resource starvationand provides ordered checks and fixes.
14 Feb 2026, 07:28 UTC

Recognizable condition
Karma prints a message referencing chrome-launcher and exits immediately. The console typically shows: 'Failed to launch Chrome. ...'
If you see this the browser process did not start Tests remain pending and no coverage data is collected.
Diagnostic table
| Cause | Quick check |
|---|---|
| Chrome binary missing or wrong path | Run which google-chrome or echo $CHROME_BIN |
| Sandbox blocked (including running as root) | Check if --no-sandbox is needed; inspect dmesg for permission denied |
| Unsupported browser name or missing launcher plugin | Verify browser field in karma.conf.js |
| Network or proxy blocking Chromium start | Export http_proxy/https_proxy temporarily or disable |
| Insufficient memory or CPU | Run free -m and top while Karma starts; look for OOM kills |
Ordered checks and fixes
Run
echo $CHROME_BINin the same shell where Karma will execute. If the output is empty or points to a non-existent file set the variable to the full path of the Chrome binary or install ChromeChromium in the expected location.export CHROME_BIN=/usr/bin/google-chromeSetting CHROME_BIN to an incorrect path will cause Karma to fail again always validate the path first.
On Linux starting Chrome (or Chromium) as root without --no-sandbox is frequently blocked by the OS. If dmesg shows Killed or out of memory messages or you are in a CI container add --no-sandbox to the Karma launch options.
browsers: [ChromeHeadlessNoSandbox]Disabling the sandbox reduces isolation. Only do this in controlled environments (local development or trusted CI).
Karma 6.x expects specific browser names. ChromeHeadless uses the chrome-launcher package; ChromeHeadlessNoSandbox is the variant when sandbox is blocked. If you previously used a custom name or renamed the launcher Karma wont resolve it. Open karma.conf.js and ensure the browser field matches an installed launcher:
// Correct browsers: [ChromeHeadless] // Incorrect (will fall back to default and likely fail) browsers: [MyCustomChrome]After changing run karma clean or delete the .cache directory before restarting.
If your environment routes traffic through a proxy that requires authentication the Chromium process may hang before launching. Temporarily unset proxy variables:
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY karma start --no-single-runIf tests start configure proxy credentials in the system network stack rather than environment variables or whitelist Karma launcher process.
Low memory or CPU can cause the launcher to abort silently. Before running Karma check free -m for available RAM and top for CPU usage. If the host is consistently below 20% free memory consider increasing swap closing unrelated processes or reducing the number of concurrent browsers in the config.
Escalation criteria
- If adjusting CHROME_BIN sandbox flags and config names does not resolve the issue verify that the ChromeChromium version matches the chrome-launcher package version expected by Karma 6.x.
- In CI environments check that the container image includes a compatible browser binary and that CHROME_BIN is propagated across job steps.
- If system logs dmesg /var/log/syslog report OOM kills or SELinuxAppArmor denials for the Chrome process involve the system security team before modifying sandbox settings.
- When the problem persists across multiple machines with identical configs the root cause may be a version mismatch between Karma chrome-launcher and the installed browser. Consider filing an issue on the Karma repository with the full console output and environment details.
Practical verification after fixes
- Run
karma start --no-single-runand confirm the browser window (or headless process) opens and tests execute without Failed to launch Chrome. - Capture the full console output and search for chrome-launcher references; absence of those lines after a fix indicates the binary path or sandbox issue is resolved.
- If using CHROME_BIN re-export the variable in every shell or CI step where Karma runs; the variable is not inherited automatically across subshells.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.