{"record":{"id":"741c3c922db92a7d","repo":"microsoft/playwright","slug":"unsupported-platform-process-platform-741c3c","errorCode":null,"errorMessage":"Unsupported platform: ${process.platform}","messagePattern":"Unsupported platform: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/serverRegistry.ts","lineNumber":252,"sourceCode":"    });\n  }\n  return await new Promise(resolve => {\n    const socket = net.createConnection(descriptor.endpoint ?? (descriptor as any).pipeName, () => {\n      socket.destroy();\n      resolve(true);\n    });\n    socket.on('error', () => resolve(false));\n  });\n}\n\nfunction computeDefaultCacheDirectory(): string {\n  if (process.platform === 'linux')\n    return process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');\n  if (process.platform === 'darwin')\n    return path.join(os.homedir(), 'Library', 'Caches');\n  if (process.platform === 'win32')\n    return process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');\n  throw new Error('Unsupported platform: ' + process.platform);\n}\n\nlet _defaultCacheDirectory: string | undefined;\n\nfunction defaultCacheDirectory(): string {\n  return _defaultCacheDirectory ??= computeDefaultCacheDirectory();\n}\n\nfunction registryDirectory(): string {\n  return path.join(defaultCacheDirectory(), 'ms-playwright', 'b');\n}\n\nexport const serverRegistry = new ServerRegistry();\n","sourceCodeStart":234,"sourceCodeEnd":266,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/serverRegistry.ts#L234-L266","documentation":"computeDefaultCacheDirectory() selects the browser-binary cache root based on process.platform: XDG_CACHE_HOME or ~/.cache on linux, ~/Library/Caches on darwin, LOCALAPPDATA or ~/AppData/Local on win32. Any other platform value throws. This runs when PLAYWRIGHT_BROWSERS_PATH is unset and no override configured.","triggerScenarios":"Running the Playwright server/registry on an OS whose process.platform is not 'linux', 'darwin', or 'win32' — e.g. a non-Linux POSIX such as FreeBSD, SunOS, or a Node build reporting an unusual platform string.","commonSituations":"CI on uncommon platforms (FreeBSD, AIX). Custom Node runtimes reporting unexpected platform values. Embedded/edge environments.","solutions":["Set PLAYWRIGHT_BROWSERS_PATH to an explicit directory so computeDefaultCacheDirectory is bypassed.","Run on a supported platform (linux/darwin/win32).","If on a close-to-Linux platform where the Linux binaries work, set the env var to mirror ~/.cache and ensure binary compatibility."],"exampleFix":"// before (FreeBSD, no env)\n// computeDefaultCacheDirectory() throws\n\n// after\n// PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright node server.js","handlingStrategy":"validation","validationCode":"function supportedPlatform() { return ['linux','darwin','win32'].includes(process.platform); }\nif (!supportedPlatform()) process.env.PLAYWRIGHT_BROWSERS_PATH ||= '/tmp/playwright-cache';","typeGuard":"function isSupportedPlatform(): boolean { return ['linux','darwin','win32'].includes(process.platform); }","tryCatchPattern":null,"preventionTips":["Set PLAYWRIGHT_BROWSERS_PATH on uncommon platforms.","Run the registry on linux/darwin/win32."],"tags":["platform","registry","cache","environment"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}