Cannot run program "npm" in directory
gruntjs, maven, node.js
Solution
Evidently you are on a Windows system. npm is a batch file and not an executable. There are issues running a batch file from maven exec plugin. You may want to explore the workaround suggested in the link, like
- deconstruct the .bat script into its actual commands
- use cmd.exe and pass node as parameter - refer to this.
Problem
When i am traversing the to `src/main/app/` folder structure where i have the `package.JSON` & gruntfile, i am able to run `npm install` and `grunt` command. But when i am trying to run the `mvn jetty:run` and a property file in the root folder of the project when POM file is present, it is throwing error that it cannot run `npm install` in the folder structure `src/main/app/`. This is the exact error: ``` [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (n pminstall) on project my-abc-web: Command execution failed. Cannot run program "npm" (in directory "C:\Users\Achyut_J01\Documents\GitHub\infras\my-abc\my-abc-web\src\main\app"): CreatePro cess error=2, The system cannot find the file specified -> [Help 1] ``` It's a Windows Machine.