{"record":{"id":"323adab5bb685b2e","repo":"microsoft/playwright","slug":"cannot-install-browsername","errorCode":null,"errorMessage":"Cannot install ${browserName}","messagePattern":"Cannot install (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/registry/index.ts","lineNumber":1347,"sourceCode":"      const packageManagerCommand = getPackageManagerExecCommand();\n      return `${packageManagerCommand} playwright ${parameters}`;\n    }\n  }\n}\n\nexport async function installBrowsersForNpmInstall(browsers: string[]) {\n  // PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD should have a value of 0 or 1\n  if (getAsBooleanFromENV('PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD')) {\n    logPolitely('Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set');\n    return false;\n  }\n  const executables: Executable[] = [];\n  if (process.platform === 'win32')\n    executables.push(registry.findExecutable('winldd')!);\n  for (const browserName of browsers) {\n    const executable = registry.findExecutable(browserName);\n    if (!executable || executable.installType === 'none')\n      throw new Error(`Cannot install ${browserName}`);\n    executables.push(executable);\n  }\n\n  await registry.install(executables);\n}\n\n// for launchApp -> UI Mode / Trace Viewer\nexport function findChromiumChannelBestEffort(sdkLanguage: string): string | undefined {\n  // Fall back to the stable channels of popular vendors to work out of the box.\n  // Null means no installation and no channels found.\n  let channel = null;\n  for (const name of ['chromium', 'chrome', 'msedge']) {\n    try {\n      registry.findExecutable(name)!.executablePathOrDie(sdkLanguage);\n      channel = name === 'chromium' ? undefined : name;\n      break;\n    } catch (e) {\n    }","sourceCodeStart":1329,"sourceCodeEnd":1365,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/registry/index.ts#L1329-L1365","documentation":"Thrown by installBrowsersForNpmInstall (the npm postinstall hook) when a browser name listed in the package's browsers.json 'browsers' array is not found by registry.findExecutable or has installType 'none'. This means the package declares a browser to install at install time that this Playwright build cannot install.","triggerScenarios":"npm install / yarn install running Playwright's postinstall where browsers.json references a browserName that findExecutable cannot resolve or that is detection-only; typically only happens with a corrupt or mismatched browsers.json or a hand-edited package.","commonSituations":"A vendored/forked Playwright with an inconsistent browsers.json; a partial publish where browsers.json and registry definitions drifted; an old browsers.json carried over an upgrade.","solutions":["Reinstall the playwright/playwright-core package cleanly to restore a consistent browsers.json.","Set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 to bypass postinstall download, then install browsers explicitly afterward.","Upgrade to a matching Playwright version where browsers.json and the registry agree.","If forked, regenerate browsers.json so every listed name maps to an installable executable."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await installBrowsersForNpmInstall(browsers);\n} catch (e) {\n  if (/Cannot install/.test(e.message)) {\n    console.warn('Postinstall browser install failed; set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 and install manually');\n  } else throw e;\n}","preventionTips":["Set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 in environments where postinstall cannot succeed, then install browsers explicitly.","Reinstall the Playwright package cleanly to restore a consistent browsers.json.","Keep browsers.json and the Playwright version in sync; avoid hand-editing."],"tags":["install","npm-postinstall","registry","browsers-json"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}