microsoft/playwright · error · Error

Unsupported platform: ${process.platform}

Error message

Unsupported platform: ${process.platform}

What it means

Thrown by computeDefaultCacheDirectory when process.platform is not linux, darwin, or win32. Playwright only knows how to compute a default cache directory (where browsers are stored) on those three platforms; any other platform (freebsd, aix, sunos, etc.) is rejected rather than guessing a path.

Source

Thrown at packages/playwright-core/src/server/registry/index.ts:384

    'mac13-arm64': undefined,
    'mac14': 'builds/android/%s/android.zip',
    'mac14-arm64': 'builds/android/%s/android.zip',
    'mac15': 'builds/android/%s/android.zip',
    'mac15-arm64': 'builds/android/%s/android.zip',
    'mac26': 'builds/android/%s/android.zip',
    'mac26-arm64': 'builds/android/%s/android.zip',
    'win64': 'builds/android/%s/android.zip',
  },
};

function computeDefaultCacheDirectory(): string {
  if (process.platform === 'linux')
    return process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');
  if (process.platform === 'darwin')
    return path.join(os.homedir(), 'Library', 'Caches');
  if (process.platform === 'win32')
    return process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
  throw new Error('Unsupported platform: ' + process.platform);
}

let _defaultCacheDirectory: string | undefined;

export function defaultCacheDirectory(): string {
  return _defaultCacheDirectory ??= computeDefaultCacheDirectory();
}

export function defaultRegistryDirectory(): string {
  return path.join(defaultCacheDirectory(), 'ms-playwright');
}

export const registryDirectory = (() => {
  let result: string;

  const envDefined = getFromENV('PLAYWRIGHT_BROWSERS_PATH');
  if (envDefined === '0')
    result = path.join(packageRoot, '.local-browsers');

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Run on a supported platform (Linux, macOS, Windows), ideally via the official Playwright Docker image on Linux.
  2. If you must use another platform, set the PLAYWRIGHT_BROWSERS_PATH (cache) and registry env vars explicitly, but browser binaries may still not be provided for that platform.
  3. Verify process.platform is reported correctly; if a custom Node build misreports it, use a standard Node build.

Example fix

# use a supported platform / official image
FROM mcr.microsoft.com/playwright:v1.0.0-jammy
# or set cache path explicitly (binaries must still exist for the platform)
PLAYWRIGHT_BROWSERS_PATH=/opt/pw-browsers
Defensive patterns

Strategy: validation

Validate before calling

const supported = new Set(['linux', 'darwin', 'win32']);
if (!supported.has(process.platform))
  throw new Error(`Unsupported platform ${process.platform}; use Linux/macOS/Windows or the official image`);

Type guard

function isSupportedPlatform(p: string): p is 'linux' | 'darwin' | 'win32' {
  return p === 'linux' || p === 'darwin' || p === 'win32';
}

Prevention

When it happens

Trigger: Running Playwright on an unsupported OS (e.g. FreeBSD, OpenBSD, AIX, SmartOS); a misreported platform due to a custom Node build; running in an unusual emulated environment that reports a different platform string.

Common situations: Trying to run browsers on FreeBSD/AIX; container or emulation layers that alter process.platform; forks of Node that report a non-standard platform.

Related errors


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