[BUG] can't run child_process.fork with string code
damartripamungkas opened this issue · 1 comments
damartripamungkas commented
What version of pkg are you using?
5.8.1
What version of Node.js are you using?
20.3.1
What operating system are you using?
macOs, Windows, Linux
What CPU architecture are you using?
x64
What Node versions, OSs and CPU architectures are you building for?
node18
Describe the Bug
can't run child_process.fork
with string code and parameter { execArgv: ["--eval"] }
full code :
const { fork } = require("node:child_process");
const codeStr = `
setInterval(() => {
console.log('sub process:' + Math.random())
}, 1000)
`;
fork(codeStr, { execArgv: ["--eval"] });
error :
node:internal/modules/cjs/loader:949
throw err;
^
Error: Cannot find module 'C:\custom-main\--eval'
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)←[39m
at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46)
←[90m at Module._load (node:internal/modules/cjs/loader:787:27)←[39m
at Function.runMain (pkg/prelude/bootstrap.js:1979:12)
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Node.js v18.5.0
Expected Behavior
running
To Reproduce
above
damartripamungkas commented
solved because I changed the method to worker_thread, not because of anything else