mihomo-party-org/clash-party · error · Error

Unsupported platform: ${platform}-${arch}

Error message

Unsupported platform: ${platform}-${arch}

What it means

getBindingName() maps the current process.platform/process.arch to a prebuilt native .node filename for the sysproxy module. When the running platform/arch combination has no prebuilt binary in the lookup table, it throws 'Unsupported platform: <platform>-<arch>'. This is a build/packaging-time coverage error: the native module simply was not compiled or shipped for this OS+CPU pair.

Source

Thrown at src/native/sysproxy/index.js:58

          ? 'sysproxy.win32-ia32-msvc-win7.node'
          : 'sysproxy.win32-ia32-msvc.node'
      if (arch === 'arm64') return 'sysproxy.win32-arm64-msvc.node'
      break
    case 'darwin':
      if (arch === 'x64') return 'sysproxy.darwin-x64.node'
      if (arch === 'arm64') return 'sysproxy.darwin-arm64.node'
      break
    case 'linux':
      if (isMusl()) {
        if (arch === 'x64') return 'sysproxy.linux-x64-musl.node'
        if (arch === 'arm64') return 'sysproxy.linux-arm64-musl.node'
      } else {
        if (arch === 'x64') return 'sysproxy.linux-x64-gnu.node'
        if (arch === 'arm64') return 'sysproxy.linux-arm64-gnu.node'
      }
      break
  }
  throw new Error(`Unsupported platform: ${platform}-${arch}`)
}

function getResourcesPath() {
  // 开发环境:优先使用 process.cwd()
  const cwd = process.cwd()
  if (existsSync(join(cwd, 'extra', 'sidecar'))) {
    return cwd
  }
  // Electron 打包后的路径
  if (process.resourcesPath && existsSync(join(process.resourcesPath, 'sidecar'))) {
    return process.resourcesPath
  }
  // 备选:使用 app.getAppPath() (Electron 特有)
  try {
    const { app } = require('electron')
    const appPath = app.getAppPath()
    if (existsSync(join(appPath, 'extra', 'sidecar'))) {
      return appPath

View on GitHub (pinned to 911e090537)

Solutions

  1. Check the actual process.platform and process.arch in the error text and confirm whether a prebuilt sysproxy binary exists for that pair in extra/sidecar or the packaged resources.
  2. If the platform should be supported, add a case to getBindingName() returning the correct '<name>.<platform>-<arch>-<libc>.node' filename and build the binary via the native build pipeline.
  3. If musl/Alpine is the issue, install gcompat or switch to a glibc-based distro, or produce a '-musl' variant of the binding.
  4. As a last resort, run the app on a supported platform (linux-x64, linux-arm64, darwin-x64/arm64, win32-x64).

Example fix

// before
throw new Error(`Unsupported platform: ${platform}-${arch}`)
// after
if (platform === 'linux' && arch === 'arm64' && isMusl()) return 'sysproxy.linux-arm64-musl.node'
throw new Error(`Unsupported platform: ${platform}-${arch}`)
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = [['darwin','x64'],['darwin','arm64'],['win32','x64'],['linux','x64'],['linux','arm64']]
if (!SUPPORTED.some(([p, a]) => process.platform === p && process.arch === a)) {
  console.error(`Unsupported platform: ${process.platform}-${process.arch}`)
}

Try / catch

try {
  const sysproxy = require('src/native/sysproxy')
  sysproxy.triggerManualProxy(true, host, port)
} catch (e) {
  if (e.message.startsWith('Unsupported platform:')) {
    // degrade gracefully: disable system-proxy features
  }
}

Prevention

When it happens

Trigger: Launching the app (module init calls loadBinding()->bindingName()->getBindingName()) on a platform not covered by the switch, e.g. win32-arm64, freebsd-x64, darwin-x86 (32-bit), linux on musl-only distros if only gnu builds ship, or any exotic arch like ppc64/loong64.

Common situations: Running the Electron app on Windows ARM or Linux ARM with a glibc/musl mismatch; CI matrix testing on an unsupported OS; users on Alpine/musl where the '-gnu' suffix binary cannot load; running under a newly released platform before native CI artifacts exist.

Related errors


AI-assisted analysis of mihomo-party-org/clash-party@911e090537 (2026-08-30). Data as JSON: /api/errors/6454843e4c4f8694. Report an issue: GitHub.