{"record":{"id":"8044468ac9d46cff","repo":"microsoft/playwright","slug":"failed-to-install-windows-dependencies","errorCode":null,"errorMessage":"Failed to install windows dependencies!","messagePattern":"Failed to install windows dependencies!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/registry/dependencies.ts","lineNumber":88,"sourceCode":"  // This is based on: https://stackoverflow.com/questions/42524606/how-to-get-windows-version-using-node-js/44916050#44916050\n  // The table with versions is taken from: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw#remarks\n  // Windows 7 is not supported and is encoded as `6.1`.\n  return major > 6 || (major === 6 && minor > 1);\n}\n\nexport type DependencyGroup = 'chromium' | 'firefox' | 'webkit' | 'tools';\n\nexport async function installDependenciesWindows(targets: Set<DependencyGroup>, dryRun: boolean): Promise<void> {\n  if (targets.has('chromium')) {\n    const command = 'powershell.exe';\n    const args = ['-ExecutionPolicy', 'Bypass', '-File', path.join(binPath, 'install_media_pack.ps1')];\n    if (dryRun) {\n      console.log(`${command} ${quoteProcessArgs(args).join(' ')}`); // eslint-disable-line no-console\n      return;\n    }\n    const { code } = await spawnAsync(command, args, { cwd: binPath, stdio: 'inherit' });\n    if (code !== 0)\n      throw new Error('Failed to install windows dependencies!');\n  }\n}\n\nexport async function installDependenciesLinux(targets: Set<DependencyGroup>, dryRun: boolean) {\n  const libraries: string[] = [];\n  const platform = hostPlatform;\n  if (!isOfficiallySupportedPlatform)\n    console.warn(`BEWARE: your OS is not officially supported by Playwright; installing dependencies for ${platform} as a fallback.`); // eslint-disable-line no-console\n  for (const target of targets) {\n    const info = deps[platform];\n    if (!info) {\n      console.warn(`Cannot install dependencies for ${platform} with Playwright ${getPlaywrightVersion()}!`);  // eslint-disable-line no-console\n      return;\n    }\n    libraries.push(...info[target]);\n  }\n  const uniqueLibraries = Array.from(new Set(libraries));\n  if (dryRun) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/registry/dependencies.ts#L70-L106","documentation":"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).","triggerScenarios":"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.","commonSituations":"CI runners without admin privileges; Windows N/KN editions missing media feature pack; antivirus blocking PowerShell script execution; stale or corrupted Playwright install.","solutions":["Run the install command from an elevated (Administrator) PowerShell session.","Run with the --dry-run flag first to see the exact PowerShell command, then execute it manually to read the underlying error.","On Windows N/KN editions, install the Media Feature Pack manually via Windows Settings > Optional features, then re-run."],"exampleFix":"# inspect the failing command first\nnpx playwright install-deps chromium --dry-run\n# then run elevated\n# (Admin PowerShell)\nnpx playwright install-deps chromium","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await installDeps();\n} catch (e) {\n  if (/Failed to install windows dependencies!/.test(e.message)) {\n    // re-run elevated, or install Media Feature Pack manually, then retry\n  } else throw e;\n}","preventionTips":["Run install-deps from an elevated PowerShell session.","Use --dry-run first to inspect the exact failing command.","Pre-install the Media Feature Pack on Windows N/KN images."],"tags":["install","windows","dependencies","powershell","system"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}