From fd191a748370dc1300305dc75efc3dd83dd60c6c Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 12 Oct 2023 11:40:05 -0400 Subject: [PATCH] Fix installer for npm v10+ (#2258) --- build/npm/v2-jf/init.js | 6 +++--- build/npm/v2/init.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/npm/v2-jf/init.js b/build/npm/v2-jf/init.js index 4f79dfa4b..8b5499b1e 100644 --- a/build/npm/v2-jf/init.js +++ b/build/npm/v2-jf/init.js @@ -97,8 +97,8 @@ function isValidNpmVersion() { const child_process = require("child_process"); const npmVersionCmdOut = child_process.execSync("npm version -json"); const npmVersion = JSON.parse(npmVersionCmdOut).npm; - // Supported since version 5.0.0 - return parseInt(npmVersion.charAt(0)) > 4; + // Supported since version 5.0.0 (also support npm v10+) + return parseInt(npmVersion.split('.')[0]) > 4; } function writeToFile(response) { @@ -153,4 +153,4 @@ function getFileName() { executable += ".exe"; } return executable; -} \ No newline at end of file +} diff --git a/build/npm/v2/init.js b/build/npm/v2/init.js index 1f919b3da..e37011c6b 100644 --- a/build/npm/v2/init.js +++ b/build/npm/v2/init.js @@ -97,8 +97,8 @@ function isValidNpmVersion() { const child_process = require("child_process"); const npmVersionCmdOut = child_process.execSync("npm version -json"); const npmVersion = JSON.parse(npmVersionCmdOut).npm; - // Supported since version 5.0.0 - return parseInt(npmVersion.charAt(0)) > 4; + // Supported since version 5.0.0 (also support npm v10+) + return parseInt(npmVersion.split('.')[0]) > 4; } function writeToFile(response) { @@ -153,4 +153,4 @@ function getFileName() { executable += ".exe"; } return executable; -} \ No newline at end of file +}