Skip to content

Commit

Permalink
Fix installer for npm v10+ (#2258)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-siek authored Oct 12, 2023
1 parent de0e564 commit fd191a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build/npm/v2-jf/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -153,4 +153,4 @@ function getFileName() {
executable += ".exe";
}
return executable;
}
}
6 changes: 3 additions & 3 deletions build/npm/v2/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -153,4 +153,4 @@ function getFileName() {
executable += ".exe";
}
return executable;
}
}

0 comments on commit fd191a7

Please sign in to comment.