{"record":{"id":"ea8b27cdd07451ca","repo":"facebook/flow","slug":"platform-not-supported","errorCode":null,"errorMessage":"Platform not supported.","messagePattern":"Platform not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/flow-bin/cli.js","lineNumber":19,"sourceCode":"#!/usr/bin/env node\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\nvar spawn = require('child_process').spawn;\n\nvar input = process.argv.slice(2);\nvar bin = require('./');\n\nif (bin !== null) {\n  spawn(bin, input, {stdio: 'inherit'})\n    .on('exit', process.exit);\n} else {\n  throw new Error('Platform not supported.');\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/facebook/flow/blob/5c865861998a8ccb7dbc82b0c1f511e9ef60c3d9/packages/flow-bin/cli.js#L1-L21","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Reinstall dependencies without skipping optional packages: remove node_modules and lockfile entries, then `npm install` (do not pass --no-optional/--omit=optional).","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.","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."],"exampleFix":"// before (Dockerfile on Alpine)\nFROM node:18-alpine\nRUN npm ci && npx flow check\n// after\nFROM node:18\nRUN npm ci && npx flow check","handlingStrategy":"fallback","validationCode":"// before invoking the CLI\nconst bin = require('flow-bin');\nif (bin === null) {\n  console.error('Flow binary unavailable for', process.platform, process.arch);\n  process.exit(1);\n}","typeGuard":"const isFlowBinAvailable = (b) => typeof b === 'string' && b.length > 0;","tryCatchPattern":"try {\n  execFileSync(require.resolve('flow-bin'), args, { stdio: 'inherit' });\n} catch (err) {\n  if (/Platform not supported/.test(err.message)) {\n    console.error('Unsupported platform; install the matching @flow-bin/<platform> package.');\n  }\n  throw err;\n}","preventionTips":["Never install with --no-optional / omit=optional for flow-bin projects.","Verify your CI base image platform/arch is supported by your Flow version.","Pin Flow versions and test installs on all target platforms."],"tags":["cli","platform","optional-dependency","spawn"],"backgroundTag":"unsupported-platform","analyzedSha":"5c865861998a8ccb7dbc82b0c1f511e9ef60c3d9","analyzedAt":"2026-09-08T04:32:53.179Z","contentChangedAt":"2026-09-08T04:32:53.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}