evanw/esbuild · error · Error

The "esbuild" package cannot be installed because ${os} is t

Error message

The "esbuild" package cannot be installed because ${os} is too outdated.

The Go compiler (which esbuild relies on) no longer supports ${os},
which means the "esbuild" binary executable can't be run. You can either:

  * Update your version of macOS to one that the Go compiler supports
  * Use the "esbuild-wasm" package instead of the "esbuild" package
  * Build esbuild yourself using an older version of the Go compiler

What it means

Thrown by `validateBinaryVersion` in `node-install.ts` only when the esbuild binary fails to execute AND the platform is macOS AND the error matches `_SecTrustEvaluateWithError` — the macOS Security framework refusing to validate the binary's signature/trust. The Go toolchain that builds esbuild dropped support for older macOS releases, so prebuilt esbuild binaries can no longer launch there.

Source

Thrown at lib/npm/node-install.ts:45

      // installed from the Snap Store. This is not a problem when you download
      // the official version of node. The problem appears to be that stderr
      // (i.e. file descriptor 2) isn't writable?
      //
      // More info:
      // - https://snapcraft.io/ (what the Snap Store is)
      // - https://nodejs.org/dist/ (download the official version of node)
      // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
      //
      stdio: 'pipe',
    }).toString().trim()
  } catch (err) {
    if (os.platform() === 'darwin' && /_SecTrustEvaluateWithError/.test(err + '')) {
      let os = 'this version of macOS'
      try {
        os = 'macOS ' + child_process.execFileSync('sw_vers', ['-productVersion']).toString().trim()
      } catch {
      }
      throw new Error(`The "esbuild" package cannot be installed because ${os} is too outdated.

The Go compiler (which esbuild relies on) no longer supports ${os},
which means the "esbuild" binary executable can't be run. You can either:

  * Update your version of macOS to one that the Go compiler supports
  * Use the "esbuild-wasm" package instead of the "esbuild" package
  * Build esbuild yourself using an older version of the Go compiler
`)
    }
    throw err
  }
  if (stdout !== packageJSON.version) {
    throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`)
  }
}

function isYarn(): boolean {
  const { npm_config_user_agent } = process.env

View on GitHub (pinned to 6ff1d8b0d8)

Solutions

  1. Update macOS to a version the current Go toolchain supports (typically one of the two most recent major releases).
  2. Switch the dependency to `esbuild-wasm` which doesn't need a native binary.
  3. Pin esbuild to an older release whose prebuilt binary was built with a Go version that still supported your macOS.
  4. Build esbuild from source using a Go compiler version that still targets your macOS, then point `ESBUILD_BINARY_PATH` at it.

Example fix

// package.json
// before
"devDependencies": { "esbuild": "^0.25.0" }

// after (avoid native binary entirely)
"devDependencies": { "esbuild-wasm": "^0.25.0" }
// then: import * as esbuild from 'esbuild-wasm'
Defensive patterns

Strategy: fallback

Validate before calling

import os from 'os'
function macOSNeedsWasmFallback(): boolean {
  if (process.platform !== 'darwin') return false
  const [major] = os.release().split('.').map(Number) // Darwin kernel major
  // macOS 10.13 ~= Darwin 17; pick a threshold matching the Go release notes
  return major < 20 // conservative cutoff; adjust per your Go version
}

Prevention

When it happens

Trigger: Running esbuild's postinstall (`node install.js`) on a macOS version old enough that the downloaded native binary cannot pass `_SecTrustEvaluateWithError`. The install script catches the execFileSync failure and re-raises this friendly message.

Common situations: CI on an old macOS image (e.g. macOS 10.13/10.14); legacy Mac Minis pinned to an old OS; corporate machines behind on updates; upgrading esbuild in a project whose dev macOS is too old for the new Go runtime.

Related errors


AI-assisted analysis of evanw/esbuild@6ff1d8b0d8 (2026-08-03). Data as JSON: /data/errors/20bd8b37de6365a7.json. Report an issue: GitHub.