1
我想使用nodejs在命令提示符下運行命令。
基於https://dzone.com/articles/understanding-execfile-spawn-exec-and-fork-in-node,我使用exec vs execFile nodeJs
child_process.execFile('protractor', ['./src/convertedJs/tempProtractorconfig.js'], (err, stdout, stderr) => {}
上面的代碼拋出一個ENOENT錯誤。
但是當我運行
child_process.exec('protractor ./src/convertedJs/tempProtractorconfig.js', (err,stdout,stderr) => {}`
一切工作正常。
有人可以解釋發生了什麼?
你確定你是從同一目錄中運行他們兩個? –
yepss ..我在同一個目錄中運行 –