diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..07764a7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1ceba..48e4e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Webtools releases ## [Unreleased] +### Fixed +- Workaround for a Windows issue afflicting modern node versions. + - Cannot run program "...\build\node-install\node\npm.cmd" ...: CreateProcess error=2, The system cannot find the file specifie ## [1.2.0] - 2025-07-28 ### Added diff --git a/build.gradle b/build.gradle index 752e3eb..5ef4b5e 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ apply from: 干.file('base/sonatype.gradle') dependencies { // node.js api 'com.github.eirslett:frontend-maven-plugin:1.15.1' + implementation 'com.diffplug.durian:durian-swt.os:5.0.1' // static file server String VER_JETTY = '11.0.25' api "org.eclipse.jetty:jetty-server:$VER_JETTY" diff --git a/src/main/java/com/diffplug/webtools/node/SetupCleanupNode.java b/src/main/java/com/diffplug/webtools/node/SetupCleanupNode.java index 500cb4a..6225003 100644 --- a/src/main/java/com/diffplug/webtools/node/SetupCleanupNode.java +++ b/src/main/java/com/diffplug/webtools/node/SetupCleanupNode.java @@ -15,11 +15,13 @@ */ package com.diffplug.webtools.node; +import com.diffplug.common.swt.os.OS; import com.github.eirslett.maven.plugins.frontend.lib.FrontendPluginFactory; import com.github.eirslett.maven.plugins.frontend.lib.InstallationException; import com.github.eirslett.maven.plugins.frontend.lib.ProxyConfig; import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException; import java.io.File; +import java.io.IOException; import java.io.Serializable; import java.nio.file.Files; import java.util.Collections; @@ -55,6 +57,15 @@ protected void doStart(SetupCleanupNode key) throws TaskRunnerException, Install .setNodeVersion(key.nodeVersion) .setNpmVersion(key.npmVersion) .install(); + if (OS.getNative().isWindows()) { + // copy npm.cmd as a windows workaround + try { + Files.copy(key.installDir.toPath().resolve("node/node_modules/npm/bin/npm.cmd"), + key.installDir.toPath().resolve("node/npm.cmd")); + } catch (IOException e) { + throw new RuntimeException(e); + } + } factory.getNpmRunner(proxyConfig, null) .execute("ci", null); }