From 6861df7638367a08f4660de2cdb2e6d27fec61cc Mon Sep 17 00:00:00 2001 From: Dax Date: Wed, 7 Oct 2026 23:05:35 -0400 Subject: [PATCH] fix(cli): reject stale platform binaries during install (#53845) --- packages/cli/script/postinstall.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/script/postinstall.mjs b/packages/cli/script/postinstall.mjs index 6c4b6378e7c..551511eead5 100644 --- a/packages/cli/script/postinstall.mjs +++ b/packages/cli/script/postinstall.mjs @@ -116,6 +116,10 @@ function copyBinary(source) { function resolveBinary(name) { const packagePath = require.resolve(`${name}/package.json`) + // Package managers keep an older platform package when the matching version is not yet on the registry, + // which would silently install the previous release under the new launcher. + const version = JSON.parse(fs.readFileSync(packagePath, "utf8")).version + if (version !== dependencies[name]) throw new Error(`${name} is ${version}, expected ${dependencies[name]}`) return path.join(path.dirname(packagePath), "bin", sourceBinary) }