facebook/relay · error

Platform "${process.platform} (${process.arch})" not support

Error message

Platform "${process.platform} (${process.arch})" not supported.

What it means

relay-compiler ships platform-specific native binaries (via optional dependencies like relay-compiler-linux-x64). The CLI entry resolves the right binary for process.platform/process.arch; if none matches, it throws. This means either your platform/arch is genuinely unsupported or the binary package failed to install.

Source

Thrown at packages/relay-compiler/cli.js:23

 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 * @noflow
 * @oncall relay
 */

'use strict';

var bin = require('./');
var spawn = require('child_process').spawn;

var input = process.argv.slice(2);

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

View on GitHub (pinned to 668b1b85e0)

Solutions

  1. Reinstall dependencies so the platform binary package is fetched: delete node_modules + lockfile and run install without --no-optional / --ignore-scripts
  2. Check your OS/arch against the published relay-compiler binaries; upgrade relay-compiler to a version supporting your platform (e.g. linux-arm64, musl)
  3. If installing on alpine/musl, use a glibc image (e.g. node:XX-bookworm) or a relay-compiler version with musl builds
  4. For truly unsupported platforms, run the compiler elsewhere (CI on supported OS) or use the JS API if available

Example fix

// Dockerfile before
FROM node:18-alpine
// after
FROM node:18-bookworm-slim
Defensive patterns

Strategy: validation

Validate before calling

import {existsSync} from 'fs';
// ensure the optional platform binary package was installed
const pkg = `relay-compiler-${process.platform}-${process.arch}`;
if (!existsSync(require.resolve(pkg + '/package.json'))) {
  throw new Error('relay-compiler binary missing for ' + process.platform + '/' + process.arch);
}

Prevention

When it happens

Trigger: Running the relay-compiler CLI on an OS/CPU without a published binary (e.g. FreeBSD, musl/alpine in older versions, ARM Windows); or when the platform-specific optional dependency was skipped (npm --no-optional, yarn bug with optionalDependencies, offline mirror, pnpm config) so `bin` resolves to null even on a supported platform.

Common situations: Docker alpine images; CI caching node_modules across platforms (macOS install used in linux container); npm/yarn installs that omit optional dependencies; unusual architectures like linux-arm64 on older relay-compiler versions.

Related errors


AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02). Data as JSON: /api/errors/aec7d945df89fa46. Report an issue: GitHub.