From a7f9a8e58a87437063e8611bdee47490f0273271 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Tue, 22 Jul 2025 17:22:49 +0200 Subject: [PATCH 1/2] Better error message if platform binaries package is not found --- cli/common/bins.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/cli/common/bins.js b/cli/common/bins.js index 1844607281..77f3e2be48 100644 --- a/cli/common/bins.js +++ b/cli/common/bins.js @@ -6,11 +6,28 @@ const target = `${process.platform}-${process.arch}`; +const supportedPlatforms = [ + "darwin-arm64", + "darwin-x64", + "linux-arm64", + "linux-x64", + "win32-x64", +]; + /** @type {BinaryModuleExports} */ let mod; -try { - mod = await import(`@rescript/${target}`); -} catch { + +if (supportedPlatforms.includes(target)) { + const binPackageName = `@rescript/${target}`; + + try { + mod = await import(binPackageName); + } catch { + throw new Error( + `Package ${binPackageName} not found. Make sure the rescript package is installed correctly.`, + ); + } +} else { throw new Error(`Platform ${target} is not supported!`); } From d4c413e7a422b191f344a368df14711347095c5a Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Tue, 22 Jul 2025 18:00:15 +0200 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6c95c92b..4a1241e7db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ #### :nail_care: Polish - Configuration fields `bs-dependencies`, `bs-dev-dependencies` and `bsc-flags` are now deprecated in favor of `dependencies`, `dev-dependencies` and `compiler-flags`. https://github.com/rescript-lang/rescript/pull/7658 +- Better error message if platform binaries package is not found. https://github.com/rescript-lang/rescript/pull/7698 #### :house: Internal