exec vs execFile nodeJs
我想使用nodejs在命令提示符下运行命令。
基于https://dzone.com/articles/understanding-execfile-spawn-exec-and-fork-in-node ,我用
child_process.execFile('protractor', ['./src/convertedJs/tempProtractorconfig.js'], (err, stdout, stderr) => {}
上面的代码抛出一个ENOENT错误。
但是当我跑步
child_process.exec('protractor ./src/convertedJs/tempProtractorconfig.js', (err,stdout,stderr) => {}`
一切正常。
有人可以解释发生了什么?