Angular tests: Disconnected, because no message in 30000 ms. / ERROR [launcher]: Cannot start ChromeHeadless
ng test could not start or keep the browser Karma uses — Chrome is missing, runs as root in a container, or the test run hung.
Disconnected, because no message in 30000 msCannot start ChromeHeadlessChromeHeadless have not captured in 60000 ms, killingERROR [launcher]: Chrome failed 2 times (timeout)No captured browser, open http://localhost:9876/ Meaning
In CI and Docker Chrome must start without a sandbox (--no-sandbox) or as a non-root user. "Disconnected, because no message in 30000 ms" usually means a test blocked the browser (infinite loop, unresolved promise without fakeAsync), or the machine is too slow. "Cannot start ChromeHeadless" means Chrome is not installed or CHROME_BIN is not set.
Common causes
- Chrome/Chromium not installed or
CHROME_BINnot set - Running as root in Docker without
--no-sandbox - A test hangs (infinite loop, never-resolving promise)
- Low memory/CPU in CI causing timeouts
- Browser launch flags missing in
karma.conf.js
⚡ Quick fix
- Use a custom launcher:
ChromeHeadlessCIwith--no-sandbox - Install Chrome and set
CHROME_BIN - Find the hanging spec by running tests one by one (
fdescribe)
Detailed fix by platform
Angular CLI
ng test --watch=false --browsers=ChromeHeadlessCI
Linux
export CHROME_BIN=$(which chromium)or install Chrome in the CI image
Code examples
karma.conf.js launcher
browsers: ['ChromeHeadlessCI'],
customLaunchers: {
ChromeHeadlessCI: { base: 'ChromeHeadless', flags: ['--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage'] },
},
browserNoActivityTimeout: 120000,How to diagnose
- Browser — Is Chrome found (CHROME_BIN)?
- Sandbox — Running as root/in Docker?
- Hang — Which spec blocks?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find control with name Angular: Error: Cannot find control with name: 'email' (reactive forms)
- Component is not resolved: templateUrl Angular tests: Component 'X' is not resolved: templateUrl: ./x.component.html — Did you run and wait for 'resolveComponentResources()'?
- Could not find the builder's node package Angular CLI: Could not find the '@angular-devkit/build-angular:browser' builder's node package / Cannot find module '@angular-devkit/build-angular/package.json'
Most viewed in Angular
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026