An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "npm" in directory

3.3k Views Asked by At

Am trying to run the below maven command in mnet module, but am facing the below-mentioned error.

mvn clean install -Dmaven.test.skip=true

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execute-script-prod) on project mnetWebApp: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "npm" (in directory "D:\Bishop\PROJECT\server\mnet\mnetWebApp\src\main\ngapp"): CreateProcess error=2, The system cannot find the file specified
[ERROR] around Ant part ...<exec failonerror="true" dir="D:\Bishop\PROJECT\server\mnet\mnetWebApp/src/main/ngapp" executable="npm">... @ 4:105 in D:\Bishop\PROJECT\server\mnet\mnetWebApp\target\antrun\build-main.xml

I have kept the path in Environmental variables, and spent quite long time on googling, still i couldn't find the root cause.

I can able to check the npm --version and all.

Below images are the env variables config

System variable for use path

enter image description here

Systems Variable for user

enter image description here

System Variables image

enter image description here

Edit:

If I execute ng version am getting this output, where you can see some issues with package manager

enter image description here

if I execute npm version am getting below output

enter image description here

0

There are 0 best solutions below