Closed damartripamungkas closed 8 months ago
5.11.0
20.9.0
Mac, Windows, Linux
x64
node20
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:1080 throw err; ^ Error: Cannot find module 'C:\custom-main\--eval' at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15) at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46) at Module._load (node:internal/modules/cjs/loader:922:27) at Function.runMain (pkg/prelude/bootstrap.js:1983:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
can be run
in above
solved because I changed the method to worker_thread, not because of anything else
What version of pkg are you using?
5.11.0
What version of Node.js are you using?
20.9.0
What operating system are you using?
Mac, Windows, Linux
What CPU architecture are you using?
x64
What Node versions, OSs and CPU architectures are you building for?
node20
Describe the Bug
can't run child_process.fork with string code and parameter { execArgv: ["--eval"] } full code :
error :
Expected Behavior
can be run
To Reproduce
in above