Question: When I try to run the following Ant script, which executes the **"npm"** command:

```
<target name ="test">
    <exec executable="npm" failonerror="true">
        <arg value="install" />
    </exec>
</target>

```

It fails with this error:

```
Execute failed: java.io.IOException: Cannot run program "npm" 
(in directory "C:\Development\workspace\traqpath\WebSource"): 
CreateProcess error=2, The system cannot find the file specified

```

The same happens when I try to run the Angular-CLI **"ng"** command:

```
<target name ="test">
        <exec executable="ng" failonerror="true">
            <arg value="build"/>
            <arg value="--prod"/>
            <arg value="--bh"/>
        </exec>
</target>

```

With the same error message, but for "ng":

```
Execute failed: java.io.IOException: Cannot run program "ng" 
(in directory "C:\Development\workspace\traqpath\WebSource"): 
CreateProcess error=2, The system cannot find the file specified

```

Both commands run without problems in the Windows Command Line, which means NodeJS installation is right, and NodeJS path is properly configured in the PATH system variable.

Answer: 
I solved the problem by modifying the Ant script to specify the full name of the "npm" executable, (and the "ng" command in the second case):

My new Ant Scripts look like this now:

```
<target name ="test">
    <exec executable="npm.cmd" failonerror="true">
        <arg value="install" />
    </exec>
</target>

<target name ="test">
        <exec executable="ng.cmd" failonerror="true">
            <arg value="build"/>
            <arg value="--prod"/>
            <arg value="--bh"/>
        </exec>
</target>

```

Notice that I used **"npm.cmd"** instead of "npm", and **"ng.cmd"** instead of "ng".
```
<target name ="test">
        <exec executable="ng" failonerror="true">
            <arg value="build"/>
            <arg value="--prod"/>
            <arg value="--bh"/>
        </exec>
</target>

```

When i try to run in linux , its again give the same error, saying 
Execute failed: java.io.IOException: Cannot run program "ng" ....

How to run in linux env through ANT