From 49ae55dde75d847263adf1de4f39904f957b53a5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Jan 2026 13:42:36 +0000 Subject: [PATCH] fix: skip symlink optimization in Volta environment Volta uses a staging directory that gets renamed after postinstall, which breaks absolute symlinks created by the bin optimization. This adds VOLTA_HOME environment detection to skip the optimization in Volta environments, allowing Volta's shim system to handle binary invocation instead. Fixes #324 --- scripts/postinstall.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 6301cf8e..5374e4f2 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -148,6 +148,13 @@ async function fixGlobalInstallBin() { * Replace the symlink to the JS wrapper with a symlink to the native binary. */ async function fixUnixSymlink() { + // Skip optimization in Volta environment - Volta uses a staging directory + // that gets renamed after postinstall, breaking absolute symlinks + if (process.env.VOLTA_HOME) { + console.log('ℹ Volta detected: skipping bin optimization (Volta manages shims)'); + return; + } + // Get npm's global bin directory (npm prefix -g + /bin) let npmBinDir; try { @@ -187,6 +194,13 @@ async function fixUnixSymlink() { * We overwrite them to invoke the native .exe directly. */ async function fixWindowsShims() { + // Skip optimization in Volta environment - Volta uses a staging directory + // that gets renamed after postinstall, breaking absolute symlinks + if (process.env.VOLTA_HOME) { + console.log('ℹ Volta detected: skipping bin optimization (Volta manages shims)'); + return; + } + // Check if this is a global install by looking for npm's global prefix let npmBinDir; try {