I am trying to run an external command in groovy. But I am getting a
Caught: java.io.IOException: Cannot run program "npm install":
CreateProcess error=2, The system cannot find the file specified.
def command = "npm install"
def proc = command.execute()
proc.waitFor()
println "This is output: " + proc?.err?.text
If you are running on windows try:
['cmd', '/c', 'npm', 'install'].execute()
Also it's good practice to use List.execute()
than String.execute()
.