From d26f7cd8ff1d07e58761651c44a7dd118979b198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Wed, 26 Jul 2023 17:15:30 +0200 Subject: [PATCH] fix: Correctly detect local binary when installing via npm --- CHANGELOG.md | 6 ++++++ scripts/install.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c031d4cce..54b53aa8d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ "You know what they say. Fool me once, strike one, but fool me twice... strike three." — Michael Scott +## 2.20.1 + +### Various fixes and improvements + +- fix: Correctly detect local binary when installing via npm (#1695) + ## 2.20.0 ### Various fixes and improvements diff --git a/scripts/install.js b/scripts/install.js index 3717d4b5ac..3410f89469 100755 --- a/scripts/install.js +++ b/scripts/install.js @@ -193,7 +193,9 @@ async function downloadBinary() { if (process.env.SENTRYCLI_USE_LOCAL === '1') { try { - const binPath = which.sync('sentry-cli'); + const binPaths = which.sync('sentry-cli', { all: true }); + if (!binPaths.length) throw new Error('Binary not found'); + const binPath = binPaths[binPaths.length - 1]; logger.log(`Using local binary: ${binPath}`); fs.copyFileSync(binPath, outputPath); return Promise.resolve();