From e04c25ea6b7e626a44fdaa26d1382d59d5ea3fa7 Mon Sep 17 00:00:00 2001 From: Kaibu Date: Sat, 6 Apr 2024 23:15:45 +0200 Subject: [PATCH] Check if process.env.windir is defined path.join will throw an error if undefined, even though platform is win32, process.env.windir may be undefined. --- lib/registry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/registry.js b/lib/registry.js index 6319ae3..bcae480 100644 --- a/lib/registry.js +++ b/lib/registry.js @@ -140,7 +140,7 @@ function pushArch(args, arch) { * Implemented only for Windows */ function getRegExePath() { - if (process.platform === 'win32') { + if (process.platform === 'win32' && process.env.windir !== undefined) { return path.join(process.env.windir, 'system32', 'reg.exe'); } else { return "REG";