Skip to content

Commit

Permalink
fix: old node installation (#14840) (#14864)
Browse files Browse the repository at this point in the history
Fix so that if we have a usable old
node installation we check the correc
path for npm script.

Fixes #14839

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
  • Loading branch information
vaadin-bot and caalador committed Oct 17, 2022
1 parent eb7b649 commit 7e058e6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class FrontendTools {
? "node/node_modules/npm/bin/"
: "node/lib/node_modules/npm/bin/";

private static final String NPM_BIN_LINUX_LEGACY_PATH = "node/node_modules/npm/bin/";

private static final String MSG_PREFIX = "%n%n======================================================================================================";
private static final String MSG_SUFFIX = "%n======================================================================================================%n";

Expand Down Expand Up @@ -1067,6 +1069,9 @@ private List<String> getNpmScriptCommand(String dir, String scriptName) {
// not work because it's a shell or windows script that looks for node
// and will fail. Thus we look for the `npm-cli` node script instead
File file = new File(dir, NPM_BIN_PATH + scriptName);
if (!FrontendUtils.isWindows() && !file.canRead()) {
file = new File(dir, NPM_BIN_LINUX_LEGACY_PATH + scriptName);
}
List<String> returnCommand = new ArrayList<>();
if (file.canRead()) {
// We return a two element list with node binary and npm-cli script
Expand Down

0 comments on commit 7e058e6

Please sign in to comment.