diff --git a/lib/npm/node-install.ts b/lib/npm/node-install.ts index c8840969cb5..4ed762c4648 100644 --- a/lib/npm/node-install.ts +++ b/lib/npm/node-install.ts @@ -234,8 +234,12 @@ async function checkAndPreparePackage(): Promise { // path without modifying the code itself. Do not remove this because // external code relies on this (in addition to esbuild's own test suite). if (ESBUILD_BINARY_PATH) { - applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); - return; + if (!fs.existsSync(ESBUILD_BINARY_PATH)) { + console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`) + } else { + applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); + return; + } } const { pkg, subpath } = pkgAndSubpathForCurrentPlatform(); diff --git a/lib/npm/node-platform.ts b/lib/npm/node-platform.ts index 02daa30915b..b2febfa8438 100644 --- a/lib/npm/node-platform.ts +++ b/lib/npm/node-platform.ts @@ -107,7 +107,11 @@ export function generateBinPath(): { binPath: string, isWASM: boolean } { // path without modifying the code itself. Do not remove this because // external code relies on this (in addition to esbuild's own test suite). if (ESBUILD_BINARY_PATH) { - return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; + if (!fs.existsSync(ESBUILD_BINARY_PATH)) { + console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`) + } else { + return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; + } } const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();