Playwright browser download fails behind a company proxy with a certificate error
Error: self signed certificate in certificate chainShort answer
Playwright downloads browsers over HTTPS, and a proxy that re-signs traffic with its own root certificate makes Node.js reject the connection. Tell Node.js to trust that root with NODE_EXTRA_CA_CERTS, route through the right proxy, or download from an internal mirror.
Fix it fast
1Find out which cause you have
Check whether a proxy or a custom root certificate is already configured in your shell. The result decides which cause below you follow.
env | grep -i -E "proxy|node_extra_ca_certs|playwright"2Match what you see, then jump to its fix
- 1
The error appears only on the company network or VPN, and the same command works on a home connectionThe network uses a custom root certificate Node.js does not trustFix - 2
Connection errors on a network where all web traffic must go through a proxyDownloads must go through a proxy that is not setFix - 3
Your IT team gives you a mirror address, and the internal server uses a private certificateYour company hosts the browser files on an internal serverFix
- 1
What does the error look like?
Error: self signed certificate in certificate chain
Cause 1 of 3
The network uses a custom root certificate Node.js does not trust
1Check
A traffic-inspecting proxy presents a certificate signed by its own root. Node.js extends its well-known root list only with the file named in NODE_EXTRA_CA_CERTS, which is read once at process start.
echo "$NODE_EXTRA_CA_CERTS"2Fix
Export the company root certificate as a PEM file and set NODE_EXTRA_CA_CERTS to it before installing the browsers.
export NODE_EXTRA_CA_CERTS="/path/to/cert.pem"
npx playwright install3Verify
The download starts instead of failing.
npx playwright install chromiumConfirmed by nodejs.org
Cause 2 of 3
Downloads must go through a proxy that is not set
1Check
Playwright can download browsers through a proxy server when HTTPS_PROXY is set for the command.
echo "$HTTPS_PROXY"2Fix
Set HTTPS_PROXY to your proxy address for the install command. The address below is an example.
HTTPS_PROXY=https://192.0.2.1 npx playwright install3Verify
The install proceeds.
HTTPS_PROXY=https://192.0.2.1 npx playwright installConfirmed by playwright.dev
Cause 3 of 3
Your company hosts the browser files on an internal server
1Check
Playwright can download from another location through PLAYWRIGHT_DOWNLOAD_HOST. Browser-specific variables such as PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST take precedence over it.
env | grep PLAYWRIGHT2Fix
Point the install at the mirror and keep NODE_EXTRA_CA_CERTS set if the mirror uses a private certificate authority.
PLAYWRIGHT_DOWNLOAD_HOST=http://192.0.2.1 npx playwright install3Verify
Run the install again.
npx playwright installConfirmed by playwright.dev
How do I stop it coming back?
- Put NODE_EXTRA_CA_CERTS in the shell profile or CI environment so every Node.js tool trusts the company root.
- Cache the browsers folder in CI so downloads happen rarely.
- Set PLAYWRIGHT_BROWSERS_PATH to a shared folder when several projects use the same browsers.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Playwright says the target page, context or browser has been closed
browserType.launch: Target page, context or browser has been closed
The error means Playwright received a command for a page, context or browser that was already closed.
4 causes, each with a fixBack end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fix