Skip to content

Commit e2b2df0

Browse files
authored
Merge pull request #9 from diffplug/feat/fix-windows
Workaround for a Windows issue afflicting modern node versions.
2 parents 9b2555f + 72cc989 commit e2b2df0

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Webtools releases
22

33
## [Unreleased]
4+
### Fixed
5+
- Workaround for a Windows issue afflicting modern node versions.
6+
- Cannot run program "...\build\node-install\node\npm.cmd" ...: CreateProcess error=2, The system cannot find the file specifie
47

58
## [1.2.0] - 2025-07-28
69
### Added

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apply from: 干.file('base/sonatype.gradle')
1515
dependencies {
1616
// node.js
1717
api 'com.github.eirslett:frontend-maven-plugin:1.15.1'
18+
implementation 'com.diffplug.durian:durian-swt.os:5.0.1'
1819
// static file server
1920
String VER_JETTY = '11.0.25'
2021
api "org.eclipse.jetty:jetty-server:$VER_JETTY"

src/main/java/com/diffplug/webtools/node/SetupCleanupNode.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
*/
1616
package com.diffplug.webtools.node;
1717

18+
import com.diffplug.common.swt.os.OS;
1819
import com.github.eirslett.maven.plugins.frontend.lib.FrontendPluginFactory;
1920
import com.github.eirslett.maven.plugins.frontend.lib.InstallationException;
2021
import com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig;
2122
import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException;
2223
import java.io.File;
24+
import java.io.IOException;
2325
import java.io.Serializable;
2426
import java.nio.file.Files;
2527
import java.util.Collections;
@@ -55,6 +57,15 @@ protected void doStart(SetupCleanupNode key) throws TaskRunnerException, Install
5557
.setNodeVersion(key.nodeVersion)
5658
.setNpmVersion(key.npmVersion)
5759
.install();
60+
if (OS.getNative().isWindows()) {
61+
// copy npm.cmd as a windows workaround
62+
try {
63+
Files.copy(key.installDir.toPath().resolve("node/node_modules/npm/bin/npm.cmd"),
64+
key.installDir.toPath().resolve("node/npm.cmd"));
65+
} catch (IOException e) {
66+
throw new RuntimeException(e);
67+
}
68+
}
5869
factory.getNpmRunner(proxyConfig, null)
5970
.execute("ci", null);
6071
}

0 commit comments

Comments
 (0)