{"id":"20bd8b37de6365a7","repo":"evanw/esbuild","slug":"the-esbuild-package-cannot-be-installed-because","errorCode":null,"errorMessage":"The \"esbuild\" package cannot be installed because ${os} is too outdated.\n\nThe Go compiler (which esbuild relies on) no longer supports ${os},\nwhich means the \"esbuild\" binary executable can't be run. You can either:\n\n  * Update your version of macOS to one that the Go compiler supports\n  * Use the \"esbuild-wasm\" package instead of the \"esbuild\" package\n  * Build esbuild yourself using an older version of the Go compiler\n","messagePattern":"The \"esbuild\" package cannot be installed because (.+?) is too outdated\\.\n\nThe Go compiler \\(which esbuild relies on\\) no longer supports (.+?),\nwhich means the \"esbuild\" binary executable can't be run\\. You can either:\n\n  \\* Update your version of macOS to one that the Go compiler supports\n  \\* Use the \"esbuild-wasm\" package instead of the \"esbuild\" package\n  \\* Build esbuild yourself using an older version of the Go compiler\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/npm/node-install.ts","lineNumber":45,"sourceCode":"      // installed from the Snap Store. This is not a problem when you download\n      // the official version of node. The problem appears to be that stderr\n      // (i.e. file descriptor 2) isn't writable?\n      //\n      // More info:\n      // - https://snapcraft.io/ (what the Snap Store is)\n      // - https://nodejs.org/dist/ (download the official version of node)\n      // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035\n      //\n      stdio: 'pipe',\n    }).toString().trim()\n  } catch (err) {\n    if (os.platform() === 'darwin' && /_SecTrustEvaluateWithError/.test(err + '')) {\n      let os = 'this version of macOS'\n      try {\n        os = 'macOS ' + child_process.execFileSync('sw_vers', ['-productVersion']).toString().trim()\n      } catch {\n      }\n      throw new Error(`The \"esbuild\" package cannot be installed because ${os} is too outdated.\n\nThe Go compiler (which esbuild relies on) no longer supports ${os},\nwhich means the \"esbuild\" binary executable can't be run. You can either:\n\n  * Update your version of macOS to one that the Go compiler supports\n  * Use the \"esbuild-wasm\" package instead of the \"esbuild\" package\n  * Build esbuild yourself using an older version of the Go compiler\n`)\n    }\n    throw err\n  }\n  if (stdout !== packageJSON.version) {\n    throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`)\n  }\n}\n\nfunction isYarn(): boolean {\n  const { npm_config_user_agent } = process.env","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/evanw/esbuild/blob/6ff1d8b0d8c134e867a397eef39702a223ebef9e/lib/npm/node-install.ts#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update macOS to a version the current Go toolchain supports (typically one of the two most recent major releases).","Switch the dependency to `esbuild-wasm` which doesn't need a native binary.","Pin esbuild to an older release whose prebuilt binary was built with a Go version that still supported your macOS.","Build esbuild from source using a Go compiler version that still targets your macOS, then point `ESBUILD_BINARY_PATH` at it."],"exampleFix":"// package.json\n// before\n\"devDependencies\": { \"esbuild\": \"^0.25.0\" }\n\n// after (avoid native binary entirely)\n\"devDependencies\": { \"esbuild-wasm\": \"^0.25.0\" }\n// then: import * as esbuild from 'esbuild-wasm'","handlingStrategy":"fallback","validationCode":"import os from 'os'\nfunction macOSNeedsWasmFallback(): boolean {\n  if (process.platform !== 'darwin') return false\n  const [major] = os.release().split('.').map(Number) // Darwin kernel major\n  // macOS 10.13 ~= Darwin 17; pick a threshold matching the Go release notes\n  return major < 20 // conservative cutoff; adjust per your Go version\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update macOS on dev/CI machines to a Go-supported release.","On CI, use macOS image matrix versions esbuild documents as supported.","Keep an esbuild-wasm fallback dependency available for legacy Macs.","Pin esbuild to a version built with a Go release supporting your OS."],"tags":["install","macos","native-binary","go-toolchain","postinstall"],"analyzedSha":"6ff1d8b0d8c134e867a397eef39702a223ebef9e","analyzedAt":"2026-08-03T19:42:38.433Z","schemaVersion":2}