dmtrKovalenko/fff · error · Error
Unsupported platform
Error message
Unsupported platform: ${platform} What it means
The fff-node getTriple() recognizes only darwin, android, linux, and win32 as process.platform values. Any other platform string makes triple resolution impossible, so the package cannot pick a native library filename or npm package and throws.
Solutions
- Run on a supported platform (macOS, Linux, Windows, Android).
- For unsupported OSes, compile the Rust lib yourself and avoid npm-package resolution paths.
- Correct test stubs to use one of the four supported platform strings.
Defensive patterns
Strategy: validation
Validate before calling
if (!['darwin','android','linux','win32'].includes(process.platform)) throw new Error(`unsupported platform ${process.platform}`); Type guard
function isSupportedPlatform(p: NodeJS.Platform): boolean {
return ['darwin','android','linux','win32'].includes(p);
} Prevention
- Guard platform before binary resolution on non-mainstream OSes.
- Use accurate process.platform mocks in tests.
- Document supported platforms for your deployment targets.
When it happens
Trigger: Invoking getTriple() (directly or via triple/getNpmPackageName) on platforms like freebsd, openbsd, aix, sunos — or in environments/tests where process.platform is mocked to an invalid value.
Common situations: Running on BSD servers or AIX, SSR/browser-ish environments where process.platform is undefined, and unit tests stubbing process.platform incorrectly.
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
- No npm package available for platform
- Unsupported platform
- No npm package available for platform
- Unsupported architecture
- Unsupported architecture
AI-assisted analysis of dmtrKovalenko/fff@7f8537e70f (2026-09-10).
Data as JSON: /api/errors/3b37580a65245bd9.
Report an issue: GitHub.
Appendix: source
Thrown at packages/fff-node/src/platform.ts:24
/**
* Get the platform triple (e.g., "x86_64-unknown-linux-gnu")
*/
export function getTriple(): string {
const platform = process.platform;
const arch = process.arch;
let osName: string;
if (platform === "darwin") {
osName = "apple-darwin";
} else if (platform === "android") {
osName = "linux-android";
} else if (platform === "linux") {
osName = detectLinuxLibc();
} else if (platform === "win32") {
osName = "pc-windows-msvc";
} else {
throw new Error(`Unsupported platform: ${platform}`);
}
const archName = normalizeArch(arch);
return `${archName}-${osName}`;
}
/**
* Detect whether we're on musl or glibc Linux
*/
function detectLinuxLibc(): string {
let output = "";
try {
output = execSync("ldd --version 2>&1", {
encoding: "utf-8",
timeout: 5000,
});
} catch (e: unknown) {
const err = e as { stdout?: string | Buffer; stderr?: string | Buffer };View on GitHub (pinned to 7f8537e70f)