facebook/flow · error · Error

Platform not supported.

Error message

Platform not supported.

What it means

flow-bin is a thin CLI wrapper that locates the platform-specific Flow binary shipped as an optional dependency and spawns it. When require('./') returns null, no binary was found for the current platform/architecture, and the CLI explicitly throws instead of continuing. It is a guard against silently doing nothing when the native flow binary is missing.

Source

Thrown at packages/flow-bin/cli.js:19

#!/usr/bin/env node
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

'use strict';
var spawn = require('child_process').spawn;

var input = process.argv.slice(2);
var bin = require('./');

if (bin !== null) {
  spawn(bin, input, {stdio: 'inherit'})
    .on('exit', process.exit);
} else {
  throw new Error('Platform not supported.');
}

View on GitHub (pinned to 5c86586199)

Solutions

  1. Reinstall dependencies without skipping optional packages: remove node_modules and lockfile entries, then `npm install` (do not pass --no-optional/--omit=optional).
  2. Check that your platform/arch has a matching @flow-bin/<platform> package and that Flow's version supports it; upgrade Flow or change base image if not.
  3. Run `npm ls flow-bin` and inspect packages/flow-bin index resolution to confirm the binary package is present; install the platform package manually if missing.

Example fix

// before (Dockerfile on Alpine)
FROM node:18-alpine
RUN npm ci && npx flow check
// after
FROM node:18
RUN npm ci && npx flow check
Defensive patterns

Strategy: fallback

Validate before calling

// before invoking the CLI
const bin = require('flow-bin');
if (bin === null) {
  console.error('Flow binary unavailable for', process.platform, process.arch);
  process.exit(1);
}

Type guard

const isFlowBinAvailable = (b) => typeof b === 'string' && b.length > 0;

Try / catch

try {
  execFileSync(require.resolve('flow-bin'), args, { stdio: 'inherit' });
} catch (err) {
  if (/Platform not supported/.test(err.message)) {
    console.error('Unsupported platform; install the matching @flow-bin/<platform> package.');
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `flow` (this cli.js) on an OS or CPU architecture for which no @flow-bin/<platform>-<arch> optional dependency was installed, or when the platform-specific package failed to install (e.g. npm installed with --no-optional, or an unsupported libc).

Common situations: Running Flow on Alpine/ musl-based images, exotic architectures (ARM before official support), CI caches that dropped optional dependencies, or package managers configured to skip optionalDependencies.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of facebook/flow@5c86586199 (2026-09-08). Data as JSON: /api/errors/ea8b27cdd07451ca. Report an issue: GitHub.