Hmbown/CodeWhale · error · Error

Unsupported platform

Error message

Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.

${unsupportedBuildHint()}

What it means

`detectBinaryNames` maps `os.platform()` through PLATFORM_ALIASES and looks it up in ASSET_MATRIX to pick the native binary. If the current platform has no entry in ASSET_MATRIX, the installer cannot know which prebuilt artifact to use and throws this error, appending a hint on how to build from source (`unsupportedBuildHint()`).

Solutions

  1. Switch to a supported platform listed in the error message (darwin, linux, win32, etc.).
  2. Follow the `unsupportedBuildHint()` output to build the binary from source and install it manually.
  3. Set CODEWHALE_RELEASE_BASE_URL / supply a prebuilt binary for your platform if your distribution provides one.

Example fix

// before (postinstall auto-detection fails on FreeBSD)
npm install -g codewhale
// after
 Unsupported platform: build from source per unsupportedBuildHint(), e.g.:
git clone <repo> && cargo build --release -p codewhale-cli && cp target/release/codewhale ~/.local/bin/
Defensive patterns

Strategy: fallback

Validate before calling

const supported = ['darwin','linux','win32'];
if (!supported.includes(os.platform())) {
  console.warn('Unsupported platform; build from source instead of npm install.');
}

Try / catch

try {
  await install();
} catch (err) {
  if (String(err.message).startsWith('Unsupported platform:')) {
    await buildFromSource(); // per unsupportedBuildHint()
  } else throw err;
}

Prevention

When it happens

Trigger: Running the npm install/postinstall for codewhale or codew on an `os.platform()` value (e.g. 'freebsd', 'openbsd', 'aix', 'sunos') that has no key in ASSET_MATRIX, and no alias maps it to a supported platform.

Common situations: CI on a niche OS image; running on FreeBSD/OpenBSD workstations; a new OS release renaming the platform string; Docker images based on unsupported systems.

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 Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/ac5fd25519f3f819. Report an issue: GitHub.

Appendix: source

Thrown at npm/codewhale/scripts/artifacts.js:76

    x64: ["codewhale-windows-x64.exe", "codew-windows-x64.exe", "codewhale.bat"],
    arm64: ["codewhale-windows-arm64.exe", "codew-windows-arm64.exe"],
  },
};

// HarmonyPC (openharmony) is an x86_64 Linux-compatible environment; map it to
// the linux binary family so npm install succeeds without a separate build target.
const PLATFORM_ALIASES = {
  openharmony: "linux",
};

function detectBinaryNames() {
  const rawPlatform = os.platform();
  const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
  const arch = os.arch();
  const defaults = ASSET_MATRIX[platform];
  if (!defaults) {
    const supported = Object.keys(ASSET_MATRIX).map(p => `'${p}'`).join(', ');
    throw new Error(
      `Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.\n\n` +
      unsupportedBuildHint(),
    );
  }
  const pair = defaults[arch];
  if (!pair) {
    const supported = Object.keys(defaults).map(a => `'${a}'`).join(', ');
    const hint = platform === "linux" && arch === "riscv64" ? unsupportedRiscvHint() : unsupportedBuildHint();
    throw new Error(
      `Unsupported architecture: ${arch} on platform ${platform}. ` +
      `Supported architectures: ${supported}.\n\n` +
      hint,
    );
  }
  return {
    platform,
    arch,
    codewhale: pair[0],

View on GitHub (pinned to 433685b202)