From 9bad19c1de393697f68d938176ed31d319ab72ef Mon Sep 17 00:00:00 2001 From: heygsc <1596920983@qq.com> Date: Mon, 5 Aug 2024 11:16:47 +0800 Subject: [PATCH] fix: SyntaxError caused by optional chaining in low version node --- 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 6d6ae5130390d..80d1a716e099a 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(