Skip to content

Commit

Permalink
Even better getNpmExecutable()
Browse files Browse the repository at this point in the history
  • Loading branch information
Joni Uitto committed Nov 7, 2019
1 parent 7617325 commit b9bea21
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,19 @@ public static List<String> getNpmExecutable(String baseDir) {
// not work because it's a shell or windows script that looks for node
// and will fail. Thus we look for the `mpn-cli` node script instead
File file = new File(baseDir, "node/node_modules/npm/bin/npm-cli.js");
List<String> returnCommand = new ArrayList<>();
if (file.canRead()) {
// We return a two element list with node binary and npm-cli script
return Arrays.asList(getNodeExecutable(baseDir),
file.getAbsolutePath());
returnCommand.add(getNodeExecutable(baseDir));
returnCommand.add(file.getAbsolutePath());
} else {
// Otherwise look for regulan `npm`
String command = isWindows() ? "npm.cmd" : "npm";
returnCommand.add(
getExecutable(baseDir, command, null).getAbsolutePath());
}
// Otherwise look for regulan `npm`
String command = isWindows() ? "npm.cmd" : "npm";
return Arrays.asList(
getExecutable(baseDir, command, null).getAbsolutePath(), "--no-update-notifier");
returnCommand.add("--no-update-notifier");
return returnCommand;
}

/**
Expand Down

0 comments on commit b9bea21

Please sign in to comment.