stablyai/orca · error · Error

Electron builds are not available on platform: ${targetPlatf

Error message

Electron builds are not available on platform: ${targetPlatform}

What it means

Thrown by getElectronPlatformPath in config/scripts/rebuild-native-deps.mjs when the resolved target platform is not one of mas, darwin, freebsd, openbsd, linux, or win32. The function maps each supported platform to Electron's in-dist executable path; an unsupported platform has no Electron build to locate, so the switch's default branch refuses. targetPlatform is resolved from ELECTRON_INSTALL_PLATFORM, then npm_config_platform, then the rebuild-detected platform.

Source

Thrown at config/scripts/rebuild-native-deps.mjs:341

    return []
  }
}

function getElectronPlatformPath() {
  const targetPlatform =
    process.env.ELECTRON_INSTALL_PLATFORM || process.env.npm_config_platform || rebuildPlatform
  switch (targetPlatform) {
    case 'mas':
    case 'darwin':
      return 'Electron.app/Contents/MacOS/Electron'
    case 'freebsd':
    case 'openbsd':
    case 'linux':
      return 'electron'
    case 'win32':
      return 'electron.exe'
    default:
      throw new Error(`Electron builds are not available on platform: ${targetPlatform}`)
  }
}

function readCliOptions(args) {
  const options = { force: false }
  for (let index = 0; index < args.length; index += 1) {
    const arg = args[index]
    if (arg === '--force') {
      options.force = true
      continue
    }
    if (arg === '--platform') {
      options.platform = readRequiredArgValue(args, (index += 1), '--platform')
      continue
    }
    if (arg.startsWith('--platform=')) {
      options.platform = readInlineArgValue(arg, '--platform')
      continue

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Use a supported platform token: darwin, mas, linux, win32, freebsd, or openbsd.
  2. If you meant macOS, use `darwin` (or `mas` for the Mac App Store build).
  3. Unset ELECTRON_INSTALL_PLATFORM / npm_config_platform to let the script auto-detect.

Example fix

// before
ELECTRON_INSTALL_PLATFORM=macos node config/scripts/rebuild-native-deps.mjs

// after
ELECTRON_INSTALL_PLATFORM=darwin node config/scripts/rebuild-native-deps.mjs
Defensive patterns

Strategy: validation

Validate before calling

const supported = new Set(['mas', 'darwin', 'freebsd', 'openbsd', 'linux', 'win32'])
const platform = process.env.ELECTRON_INSTALL_PLATFORM || process.env.npm_config_platform
if (platform && !supported.has(platform)) {
  throw new Error(`Unsupported platform '${platform}'. Use one of: ${[...supported].join(', ')}`)
}

Type guard

const SUPPORTED_PLATFORMS = new Set(['mas', 'darwin', 'freebsd', 'openbsd', 'linux', 'win32'])
function isElectronPlatform(value) {
  return typeof value === 'string' && SUPPORTED_PLATFORMS.has(value)
}

Prevention

When it happens

Trigger: Set ELECTRON_INSTALL_PLATFORM (or npm_config_platform) to an unsupported value like `aix`, `sunos`, `android`, or a typo such as `macos` (the correct value is `darwin`). The switch at lines 330-340 falls through to default and throws.

Common situations: A user copies a cross-compile snippet and sets `--platform macos` instead of `darwin`, or sets ELECTRON_INSTALL_PLATFORM to an experimental OS Electron does not ship for. The most common typo is `macos` vs `darwin`.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/e9e42a0a63c06e70. Report an issue: GitHub.