From b71982c4069083fc6f314979939e0aed54068567 Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Fri, 20 Mar 2026 18:42:44 +0800 Subject: [PATCH] fix(build): prevent node download script from deleting uv.exe on Windows (#600) --- scripts/download-bundled-node.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/download-bundled-node.mjs b/scripts/download-bundled-node.mjs index eb62ba534..025ec2b31 100644 --- a/scripts/download-bundled-node.mjs +++ b/scripts/download-bundled-node.mjs @@ -36,7 +36,12 @@ async function setupTarget(id) { echo(chalk.blue`\n📦 Setting up Node.js for ${id}...`); - await fs.remove(targetDir); + // Only remove the target binary, not the entire directory, + // to avoid deleting uv.exe or other binaries placed by other download scripts. + const outputNode = path.join(targetDir, 'node.exe'); + if (await fs.pathExists(outputNode)) { + await fs.remove(outputNode); + } await fs.remove(tempDir); await fs.ensureDir(targetDir); await fs.ensureDir(tempDir); @@ -58,7 +63,6 @@ async function setupTarget(id) { } const expectedNode = path.join(tempDir, target.sourceDir, 'node.exe'); - const outputNode = path.join(targetDir, 'node.exe'); if (await fs.pathExists(expectedNode)) { await fs.move(expectedNode, outputNode, { overwrite: true }); } else {