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

Angularjs CreateProcess错误=193,%1不是有效的Win32应用程序->;[帮助1],angularjs,node.js,maven,Angularjs,Node.js,Maven,在maven中运行exec npm update时,出现以下错误 CreateProcess错误=193,%1不是有效的Win32应用程序->[帮助1] 下面是pom文件的片段 <execution> <id>exec-npm-update</id> <phase>generate-sources</phase> <configurat

在maven中运行exec npm update时,出现以下错误 CreateProcess错误=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>

执行npm更新
生成源
${uiResourcesDir}
npm
更新
执行官

发生此问题是因为我使用的角度版本是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>

执行npm更新
生成源
${uiResourcesDir}
npm.cmd
更新
执行官

我遇到了同样的问题,正如回答的那样,如果您想运行shell或命令提示符命令而不考虑环境,则需要提供npm.cmd,而只需提供npm

。我说的是npm.cmd(windows)、npm.sh(linux)部分

将maven exec插件降级为1.4.0版,这样您就可以只提及(例如)

npm
ng

如果POM.xml必须与操作系统无关,则可以使用maven配置文件。。。见此:
<executable>npm</executable>
<executable>ng</executable>