Skip to content

Commit 2750625

Browse files
mellowareeirslett
authored andcommitted
Fix #1152: Copy npm script file
1 parent 622ac16 commit 2750625

File tree

1 file changed

+12
-1
lines changed
  • frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib

1 file changed

+12
-1
lines changed

frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/NodeInstaller.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,18 @@ private void installNodeDefault() throws InstallationException {
201201
for (String script : Arrays.asList("npm", "npm.cmd")) {
202202
File scriptFile = new File(npmDirectory, "bin" + File.separator + script);
203203
if (scriptFile.exists()) {
204-
scriptFile.setExecutable(true);
204+
File copy = new File(destinationDirectory, script);
205+
if (!copy.exists()) {
206+
try
207+
{
208+
FileUtils.copyFile(scriptFile, copy);
209+
}
210+
catch (IOException e)
211+
{
212+
throw new InstallationException("Could not copy npm", e);
213+
}
214+
copy.setExecutable(true);
215+
}
205216
}
206217
}
207218
}

0 commit comments

Comments
 (0)