fix(npm): SyntaxError caused by optional chaining in low version node (#4650)

fix: #4602
This commit is contained in:
heygsc 2024-08-05 13:01:31 +08:00 committed by GitHub
parent 649e7c30cf
commit 0fba73897c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(