Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Next.js and React

Playwright cannot install the Linux libraries its browsers need on Ubuntu 24.04

Your error

Host system is missing dependencies to run browsers.2 more lines it can show

Fix it fast

Most common cause, 1 of 3

Playwright older than 1.45 asks apt for the Ubuntu 22.04 package names

Upgrade the package, then let the new CLI install browsers and libraries together.

Fix
npm install -D @playwright/test@latest
npx playwright install --with-deps

# Python projects
pip install -U playwright
playwright install --with-deps
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

On Ubuntu 24.04, playwright install --with-deps or install-deps fails when Playwright is older than 1.45, because it still requests the Ubuntu 22.04 package list, with names like libasound2 and libicu70 that noble renamed. Upgrade to Playwright 1.65 through npm or pip and run install --with-deps again. Behind a proxy, start it as root with HTTPS_PROXY on the same line.

  • Applies to Playwright 1.65.1 (Node.js), playwright 1.65.2 (Python), Ubuntu 24.04 LTS (noble)
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Print the Playwright version the project uses and the Ubuntu release of the machine. A version below 1.45 on 24.04 is cause 1. A current version that still complains at test time is cause 2, and one that fails while apt downloads behind a proxy is cause 3.

Run this first
npx playwright --version
grep -E '^(VERSION_ID|VERSION_CODENAME)=' /etc/os-release

Then find the line you see in this list and open its fix:

  1. 1Playwright older than 1.45 asks apt for the Ubuntu 22.04 package namesnpx playwright --version prints 1.44 or lower, and apt aborts on libasound2, libicu70 or another jammy-era name
  2. 2Browsers were downloaded, but the system libraries never wereInstallation looked fine; the first test run stops with Host system is missing dependencies to run browsers and a list of packages
  3. 3A normal user runs install-deps behind a proxyThe output shows Switching to root user to install dependencies..., then apt cannot reach its mirror

What does the error look like?

  • Host system is missing dependencies to run browsers.
  • sudo npx playwright install-deps
  • Switching to root user to install dependencies...

Cause 1 of 3

Playwright older than 1.45 asks apt for the Ubuntu 22.04 package names

You seenpx playwright --version prints 1.44 or lower, and apt aborts on libasound2, libicu70 or another jammy-era name

Check

Install-deps fails on noble because older Playwright releases do not know Ubuntu 24.04. Their host detection maps every Ubuntu newer than 21 to the 22.04 profile, so the dependency step requests jammy packages. The release notes add Ubuntu 24.04 support in 1.45, whose list uses the renamed libasound2t64 and libicu74.

Check
npm ls @playwright/test playwright

Fix

Upgrade the package, then let the new CLI install browsers and libraries together. For Python, upgrade with pip and run the same install from the playwright command.

Fix
npm install -D @playwright/test@latest
npx playwright install --with-deps

# Python projects
pip install -U playwright
playwright install --with-deps

Verify

The install ends without an apt error, and the suite starts its browsers.

Verify
npx playwright test

Confirmed by playwright.dev

Did this fix it?

Cause 2 of 3

Browsers were downloaded, but the system libraries never were

You seeInstallation looked fine; the first test run stops with Host system is missing dependencies to run browsers and a list of packages

Check

A plain npx playwright install fetches only the browser builds. The shared libraries they load come from install-deps, or from the --with-deps flag that does both jobs at once, and a fresh 24.04 server or slim image lacks most of them.

Check
npx playwright test 2>&1 | grep -A15 "Host system is missing"

Fix

Run Playwright's dependency installer, which calls apt for you. Naming one browser keeps the download smaller.

Fix
sudo npx playwright install-deps chromium
# or browsers and libraries in one step
npx playwright install --with-deps chromium

Verify

The next test run starts Chromium with no missing-dependencies block in the output.

Verify
npx playwright test

Confirmed by playwright.dev

Did this fix it?

Cause 3 of 3

A normal user runs install-deps behind a proxy

You seeThe output shows Switching to root user to install dependencies..., then apt cannot reach its mirror

Check

Started without root, Playwright raises itself to root to call the package manager, and on that hop variables such as HTTPS_PROXY are not passed along. On a network where only the proxy can reach the internet, apt then fails to download.

Check
env | grep -i _proxy

Fix

Start the command as root yourself and set the proxy on the same line, so apt sees it.

Fix
sudo HTTPS_PROXY=https://192.0.2.1 npx playwright install-deps

Verify

apt fetches the packages through the proxy and the command exits cleanly.

Verify
npx playwright test

Confirmed by playwright.dev

Did this fix it?

How do I stop it coming back?

  • Pin @playwright/test (or the pip package) and upgrade it before moving runners to a newer Ubuntu; 24.04 needs 1.45 or later, and 26.04 support came in 1.61.
  • Install browsers and libraries during the image build or CI setup step, as root, never inside the test command.
  • Build test images FROM mcr.microsoft.com/playwright with the tag that matches your package version, so the libraries are already inside.

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 on the same stack: TaxiDex, Workforce, stegnor.com.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.