From 0fba73897c3003ee6bca9432bfaeb2ee1701baca Mon Sep 17 00:00:00 2001 From: heygsc <1596920983@qq.com> Date: Mon, 5 Aug 2024 13:01:31 +0800 Subject: [PATCH] fix(npm): SyntaxError caused by optional chaining in low version node (#4650) fix: #4602 --- npm/oxlint/bin/oxlint | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/npm/oxlint/bin/oxlint b/npm/oxlint/bin/oxlint index 6d6ae5130..80d1a716e 100755 --- a/npm/oxlint/bin/oxlint +++ b/npm/oxlint/bin/oxlint @@ -90,7 +90,12 @@ const PLATFORMS = { }, }; -let binPath = PLATFORMS[platform]?.[arch]?.[isMusl() ? "musl" : "gnu"]; +let binPath = ( + PLATFORMS && + PLATFORMS[platform] && + PLATFORMS[platform][arch] && + PLATFORMS[platform][arch][isMusl() ? "musl" : "gnu"] +) || null; if (binPath) { const result = require("child_process").spawnSync(