我正在尝试将master.js
复制到master1.js
。
出现以下错误:
events.js:174
throw er; // Unhandled 'error' event
^Error: spawn cp ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
master.js的代码
const { spawn } = require('child_process');
const child = spawn('cp',["master.js","master1.js"]);
child.on("exit",()=>{
console.log("copy finished")
})