1
我想在groovy中運行外部命令。但是,我得到一個如何從Groovy調用npm外部命令?
捉住:產生java.io.IOException:不能運行程序「故宮安裝」: CreateProcess的錯誤= 2,系統找不到指定的文件。
我是Groovy的新手,所以任何建議將不勝感激。我的路徑也設置好了,因爲我可以在命令行中運行npm。
def command = "npm install"
def proc = command.execute()
proc.waitFor()
println "This is output: " + proc?.err?.text
它是Windows還是Linux?如果Windows嘗試'['cmd','/ c','npm','install']。execute()'。 – Opal
窗口,它工作!謝謝你的幫助 ! – RyanCW
另外,如果Linux,我們只是切換命令爲bash? – RyanCW