Fix Playwright “Host system is missing dependencies” error on Linux
When you run Playwright tests on Linux, you may see Host system is missing dependencies to run browsers. and the browser fails to start. This happens when the browser binaries are installed but the system libraries they need (such as GTK and X11) are missing from the OS. Running npx playwright install-deps installs those libraries and fixes the problem. It typically occurs when E2E tests run on a freshly set up Ubuntu server or a CI runner that does not have the browser libraries.
I reproduced this error on a minimal Ubuntu 24.04 install without the libraries, and confirmed that the tests pass after installing them with install-deps. If you test only with Chromium, the same state does not show this message and produces a different error instead. I also describe how to tell them apart.
The test environment was an Ubuntu 24.04 minimal install (created with debootstrap --variant=minbase, with 90 packages installed), with Node.js 22.23.5 and @playwright/test 1.65.1. The CPU was x86_64. The tests were written in TypeScript and run with Chromium and Firefox. I did not test WebKit, Linux distributions other than Ubuntu such as Debian, arm64, WSL on Windows, the Playwright Docker image, or Playwright in other languages such as Python.
The full error message from Firefox
In a new directory, I ran npm i -D @playwright/test@1.65.1 and wrote one test that just checks a heading. The projects setting in the config file has two entries: Chromium (devices['Desktop Chrome']) and Firefox (devices['Desktop Firefox']).
// tests/hello.spec.ts
import { test, expect } from '@playwright/test';
test('見出しが表示される', async ({ page }) => {
await page.setContent('<h1>こんにちは</h1>');
await expect(page.getByRole('heading')).toHaveText('こんにちは');
});
I installed the browsers with npx playwright install chromium firefox (without --with-deps). When I then ran npx playwright test --project=firefox, the test failed after 3 ms (exit code 1). The output is shown below as-is.
1) [firefox] › tests/hello.spec.ts:3:1 › 見出しが表示される ───────────────────────────────────────────────
Error: browserType.launch:
╔══════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers. ║
║ Please install them with the following command: ║
║ ║
║ npx playwright install-deps ║
║ ║
║ Alternatively, use apt: ║
║ apt-get install libxcb-shm0\ ║
║ libx11-xcb1\ ║
║ libxrandr2\ ║
║ libxcomposite1\ ║
║ libxcursor1\ ║
║ libxdamage1\ ║
║ libxi6\ ║
║ libxext6\ ║
║ libxfixes3\ ║
║ libx11-6\ ║
║ libxcb1\ ║
║ libgtk-3-0t64\ ║
║ libpangocairo-1.0-0\ ║
║ libpango-1.0-0\ ║
║ libatk1.0-0t64\ ║
║ libcairo-gobject2\ ║
║ libcairo2\ ║
║ libgdk-pixbuf-2.0-0\ ║
║ libglib2.0-0t64\ ║
║ libxrender1\ ║
║ libasound2t64\ ║
║ libfreetype6\ ║
║ libfontconfig1\ ║
║ libdbus-1-3 ║
║ ║
║ <3 Playwright Team ║
╚══════════════════════════════════════════════════════╝
The English text in the box says that the dependency libraries needed to run the browsers are missing from this system, and asks you to install them with the command shown. Below it are npx playwright install-deps, and the apt-get install command to use if you prefer apt. The 24 packages listed after apt-get install are the Ubuntu packages that contain the libraries Playwright checked for and did not find.
This error actually appeared once already when I installed the browsers. At the end of the output of npx playwright install chromium firefox, the same box appeared after Playwright Host validation warning:. However, this was only a warning, and the command exited with code 0. Even though install finished successfully, running the tests still produced the error.
Installing the missing libraries with install-deps
I ran npx playwright install-deps chromium firefox as root. It printed Installing dependencies..., then updated the apt package lists and installed the packages, and finished with exit code 0. The number of installed packages went from 90 to 289. The output below shows only the beginning and end.
$ npx playwright install-deps chromium firefox
Installing dependencies...
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Get:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
(中略)
Setting up humanity-icon-theme (0.6.16) ...
Setting up ubuntu-mono (24.04-0ubuntu1) ...
Processing triggers for libc-bin (2.39-0ubuntu8) ...
After that, I ran npx playwright test. The tests passed in both Chromium and Firefox, and the error box no longer appeared.
Running 2 tests using 2 workers
✓ 2 [chromium] › tests/hello.spec.ts:3:1 › 見出しが表示される (205ms)
✓ 1 [firefox] › tests/hello.spec.ts:3:1 › 見出しが表示される (1.5s)
2 passed (3.5s)
install-deps installs more packages than the 24 listed in the error box. Among the installed packages were xvfb, which creates a virtual display, fonts-ipafont-gothic for Japanese fonts, and fonts-noto-color-emoji for emoji. These are not in the apt-get install list in the error box.
If you name the browsers, only the packages for those browsers are installed (see the official documentation on installing system dependencies). According to npx playwright install-deps --help, if you do not name any browsers, the dependencies for the default browsers (shown as "default browsers" in the help output) are installed.
Host system is missing dependencies is a problem with OS-level libraries, not with Playwright or your test code. If you are root, run npx playwright install-deps. If you are not root, add sudo. If npx is not found under sudo, run sudo env PATH="$PATH" npx playwright install-deps.
If you want to see what would be installed first, add --dry-run. However, when I ran it on a freshly set up Ubuntu, it failed with exit code 1 and printed E: Unable to locate package xvfb and similar messages. This happened because I had not yet run apt-get update, so apt could not find the packages. On a separate minimal Ubuntu install of the same kind, after running apt-get update, npx playwright install-deps --dry-run firefox printed Missing system dependencies (208): followed by the names of the missing packages (exit code 1, since some were missing). Without --dry-run, install-deps updated the package lists first, as shown in the output above. After the libraries were installed, --dry-run printed All system dependencies are installed.
When running as a non-root user
When I installed the browsers and ran the tests as a non-root user, the command in the error box included sudo.
║ sudo npx playwright install-deps ║
║ ║
║ Alternatively, use apt: ║
║ sudo apt-get install libxcb-shm0\ ║
npx is not found when using sudo
I ran sudo npx playwright install-deps firefox as shown, with a user that can use sudo. install-deps did not run and exited with code 1.
$ sudo npx playwright install-deps firefox
sudo: npx: command not found
In the test environment, Node.js was installed somewhere other than /usr/local/bin or /usr/bin. That location was on the PATH of the non-root user. However, if /etc/sudoers sets secure_path, sudo uses that value instead of the user's PATH (see the sudoers manual). In the Ubuntu test environment, secure_path was /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin, which does not include the directory where Node.js was installed.
In this case, pass the current PATH with env when you run the command.
sudo env PATH="$PATH" npx playwright install-deps firefox
In the test environment, this installed the dependency libraries, and the Firefox tests passed.
Without sudo, the command waits for a password
When I ran npx playwright install-deps firefox without sudo on a system where sudo was not installed, it printed Switching to root user to install dependencies.... It then tried to become root with su and asked for the root password at Password:. When I ran it without providing any input, it did not finish after 20 seconds, so I stopped it with timeout. When I connected /dev/null as input, it failed with su: Authentication failure. In an environment with no one at the screen, such as CI, run it as root or run it with sudo.
The official documentation on installing behind a firewall or proxy also says that on Linux, when installing dependency libraries through a proxy, you should run as root. If you are not root, Playwright tries to become root, and at that point it does not pass environment variables such as HTTPS_PROXY to the package manager.
With Chromium only, this message does not appear
When I ran npx playwright test --project=chromium in the same state (before installing the libraries), the tests failed, but the error text was different. I replaced the home directory path with ~, and omitted the launch arguments and the Call log: that follows.
Error: browserType.launch: Target page, context or browser has been closed
Browser logs:
<launching> ~/.cache/ms-playwright/chromium_headless_shell-1255/chrome-headless-shell-linux64/chrome-headless-shell (起動の引数は省略)
<launched> pid=8342
[pid=8342][err] ~/.cache/ms-playwright/chromium_headless_shell-1255/chrome-headless-shell-linux64/chrome-headless-shell: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory
If you look only at the first line, Target page, context or browser has been closed, the problem seems to be in how the test is written. The cause is in the browser log line error while loading shared libraries: libglib-2.0.so.0. When the browser started, the shared library libglib-2.0.so.0 could not be found. When I checked Chrome Headless Shell with ldd, 21 libraries were not found, including libglib-2.0.so.0, libnss3.so, libX11.so.6, and libgbm.so.1.
This error is also fixed by the same install-deps used for Firefox. After running npx playwright install-deps chromium firefox above, the number of not found entries from ldd became 0, and the Chromium tests passed too.
The reason the box message does not appear with Chromium is that Playwright's validation does not check the Chromium browser at all. In the 1.65.1 package code, the Chromium check looks inside a folder named chrome-linux. However, the browser is actually installed into chrome-linux64 and chrome-headless-shell-linux64. Since the folder is missing, the check treats it as having no missing dependencies and passes. When the browsers were installed, a file named DEPENDENCIES_VALIDATED was created in the Chrome Headless Shell folder, which marks that the check passed. No such file was created in the Firefox folder.
This behavior was reported as a Playwright bug in issue #44201, which says it has occurred since 1.57.0. The issue was closed by a change that removed the validation for Chromium and Chrome Headless Shell, rather than fixing the folder names. The Firefox and WebKit checks remain. If the browser fails to start with Chromium, and the box message is absent, check the browser log for error while loading shared libraries.
On a new environment, install browsers together with –with-deps
Adding --with-deps to npx playwright install installs the browsers and the system libraries in one step. On a separate minimal Ubuntu 24.04 install, I ran npx playwright install --with-deps chromium firefox as root. The browsers were installed, and the package count went from 90 to 289. Running npx playwright test afterward passed in both Chromium and Firefox.
The official CI documentation also uses npx playwright install --with-deps for the browser install step. In a CI configuration, place this command right after npm ci. If you want to avoid installing libraries yourself, the same page describes using the official Playwright Docker image, which already includes the libraries.
According to the official system requirements, the Linux distributions Playwright supports are Debian 12 / 13 and Ubuntu 22.04 / 24.04 / 26.04 (x86-64 and arm64).





