{"record":{"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/f6058f8364fe7ab91ca57a83e02577ed74c9cae4/lib/npm/node-install.ts#L27-L63","documentation":"During esbuild's postinstall, validateBinaryVersion() (lib/npm/node-install.ts:20) executes the native binary with --version. If that execFileSync throws AND the platform is macOS AND the error text matches /_SecTrustEvaluateWithError/, esbuild reports that the OS is too old for the Go-compiled binary. The Go toolchain (which builds esbuild's native binary) drops support for older macOS releases, so Gatekeeper's security runtime can no longer validate the binary and execution fails.","triggerScenarios":"Running `npm install esbuild` (or yarn/pnpm) on a macOS version older than what the bundled Go-built binary supports, where launching the binary fails with a _SecTrustEvaluateWithError security error.","commonSituations":"Legacy Mac hardware unable to upgrade; stale macOS CI images; corporate machines pinned to an old macOS; the notarization/Gatekeeper trust evaluation failing on an out-of-date Security framework.","solutions":["Update macOS to a release the current Go toolchain (and thus the esbuild binary) supports.","Switch from the esbuild package to the esbuild-wasm package, which is pure WebAssembly and needs no native binary.","Build esbuild from source using an older Go compiler that still targets your macOS release.","If on CI, upgrade the macOS runner image."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Check macOS version before installing native esbuild; prefer wasm if too old.\n// (Run during setup, before depending on esbuild.)\nconst { execFileSync } = require('child_process')\nfunction macosTooOldForGo(minSupported = '10.15') {\n  if (process.platform !== 'darwin') return false\n  const v = execFileSync('sw_vers', ['-productVersion']).toString().trim()\n  return v.localeCompare(minSupported, undefined, { numeric: true }) < 0\n}\n// then: install 'esbuild-wasm' instead of 'esbuild' if true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep macOS (and CI runner images) on a release the current Go toolchain supports.","Have a fallback to esbuild-wasm documented for users on old macOS.","Detect the OS version in your own installer and choose the package accordingly."],"tags":["macos","install","native-binary","go","security","gatekeeper"],"backgroundTag":null,"analyzedSha":"f6058f8364fe7ab91ca57a83e02577ed74c9cae4","analyzedAt":"2026-08-09T18:37:22.223Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}