CreateProcess error = 193,%1不是有效的Win32应用程序 - > [帮助1]

Pun*_*eet 8 maven node.js angularjs

在maven中运行exec-npm-update时,我收到以下错误:CreateProcess error = 193,%1不是有效的Win32应用程序 - > [帮助1]

下面是pom文件的片段.

<execution>
                <id>exec-npm-update</id>
                <phase>generate-sources</phase>
                <configuration>
                  <workingDirectory>${uiResourcesDir}</workingDirectory>
                  <executable>npm</executable>
                  <arguments>
                    <argument>update</argument>
                  </arguments>
                </configuration>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
Run Code Online (Sandbox Code Playgroud)

Pun*_*eet 14

出现此问题是因为我使用的角度版本是1.5.

将可执行文件从npm更改为npm.cmd解决了这个问题!

<execution>
                <id>exec-npm-update</id>
                <phase>generate-sources</phase>
                <configuration>
                  <workingDirectory>${uiResourcesDir}</workingDirectory>
                  <executable>npm.cmd</executable>
                  <arguments>
                    <argument>update</argument>
                  </arguments>
                </configuration>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
Run Code Online (Sandbox Code Playgroud)


Moh*_*Ram 5

如果您喜欢无论环境如何都运行 shell 或命令提示符命令。我说的是 npm.cmd (windows)、npm.sh (linux) 部分。

将 maven-exec-plugin 降级到版本 1.4.0,以便您可以仅提及(例如)

<executable>npm</executable>
<executable>ng</executable>
Run Code Online (Sandbox Code Playgroud)