使用npm运行脚本时,Process.send不是函数

时间:2020-09-16 10:48:45

标签: node.js spawn

当我生成如下所示的子进程时,执行的节点文件中的await new userProfileModel({ userId, userFirstName, userLastName, userCoordinates, }) .save() .then(() => { console.log('it worked!'); res.send('worked!'); }) .catch((error) => { console.log('did not worl') // console.log(error); }); 未定义。

process.send

如果我不使用npm运行脚本直接按以下方式执行节点文件,则spawn("npm", ["run", "test"], { cwd: testPath, stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env: { ...process.env, ...env } }); 可以正常工作。可以将其与运行脚本一起使用吗?

process.send

0 个答案:

没有答案
相关问题