From dc7b566a53b1ba2017da65b21e166833e0ebc438 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 12 Oct 2023 10:29:22 -0400 Subject: [PATCH] fix: support npm v10+ --- build/npm/v2/init.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 +}