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 ..我在同一个目录中运行 –