microsoft/playwright · error · Error

Failed to install windows dependencies!

Error message

Failed to install windows dependencies!

What it means

Thrown by installDependenciesWindows when the PowerShell Media Pack installer (install_media_pack.ps1) exits with a non-zero code. This script installs the Windows media components needed by the bundled browsers (chiefly for video/media playback support).

Source

Thrown at packages/playwright-core/src/server/registry/dependencies.ts:88

  // This is based on: https://stackoverflow.com/questions/42524606/how-to-get-windows-version-using-node-js/44916050#44916050
  // The table with versions is taken from: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw#remarks
  // Windows 7 is not supported and is encoded as `6.1`.
  return major > 6 || (major === 6 && minor > 1);
}

export type DependencyGroup = 'chromium' | 'firefox' | 'webkit' | 'tools';

export async function installDependenciesWindows(targets: Set<DependencyGroup>, dryRun: boolean): Promise<void> {
  if (targets.has('chromium')) {
    const command = 'powershell.exe';
    const args = ['-ExecutionPolicy', 'Bypass', '-File', path.join(binPath, 'install_media_pack.ps1')];
    if (dryRun) {
      console.log(`${command} ${quoteProcessArgs(args).join(' ')}`); // eslint-disable-line no-console
      return;
    }
    const { code } = await spawnAsync(command, args, { cwd: binPath, stdio: 'inherit' });
    if (code !== 0)
      throw new Error('Failed to install windows dependencies!');
  }
}

export async function installDependenciesLinux(targets: Set<DependencyGroup>, dryRun: boolean) {
  const libraries: string[] = [];
  const platform = hostPlatform;
  if (!isOfficiallySupportedPlatform)
    console.warn(`BEWARE: your OS is not officially supported by Playwright; installing dependencies for ${platform} as a fallback.`); // eslint-disable-line no-console
  for (const target of targets) {
    const info = deps[platform];
    if (!info) {
      console.warn(`Cannot install dependencies for ${platform} with Playwright ${getPlaywrightVersion()}!`);  // eslint-disable-line no-console
      return;
    }
    libraries.push(...info[target]);
  }
  const uniqueLibraries = Array.from(new Set(libraries));
  if (dryRun) {

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Run the install command from an elevated (Administrator) PowerShell session.
  2. Run with the --dry-run flag first to see the exact PowerShell command, then execute it manually to read the underlying error.
  3. On Windows N/KN editions, install the Media Feature Pack manually via Windows Settings > Optional features, then re-run.

Example fix

# inspect the failing command first
npx playwright install-deps chromium --dry-run
# then run elevated
# (Admin PowerShell)
npx playwright install-deps chromium
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await installDeps();
} catch (e) {
  if (/Failed to install windows dependencies!/.test(e.message)) {
    // re-run elevated, or install Media Feature Pack manually, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: Running `playwright install-deps chromium` (or the Windows deps install path) on Windows where the PowerShell script fails; PowerShell execution policy or permissions block the script; the script needs elevation and was not run elevated; Windows edition lacks the media pack.

Common situations: CI runners without admin privileges; Windows N/KN editions missing media feature pack; antivirus blocking PowerShell script execution; stale or corrupted Playwright install.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/8044468ac9d46cff. Report an issue: GitHub.