multi-process(cluster) not working with v8 options?
What version of pkg are you using?
5.5.1
What version of Node.js are you using?
v12.22.8
What operating system are you using?
centos7
What CPU architecture are you using?
x86_64 & arm64
What Node versions, OSs and CPU architectures are you building for?
node12-linux
Describe the Bug
Program run in Muti-process mode, pkg with --options (v8) , app run error Simple test code:
const cluster = require('cluster');
if (cluster.isMaster) {
for (let i = 0; i < 2; i++)
cluster.fork();
}
else if (cluster.isWorker){
console.log("Create worker_%d(%d)", cluster.worker.id, process.pid);
}
package it with v8-options:
pkg -t linux index.js --options max-old-space-size=3072
when app run, error:
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module '/git/test/--max-old-space-size=3072'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function._resolveFilename (pkg/prelude/bootstrap.js:1819:46)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.runMain (pkg/prelude/bootstrap.js:1847:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
PS
I also test with the node V16.13.1, same error
Expected Behavior
run fine in multi-process mode
To Reproduce
As decribe
I find some one had face same probem, #459
Before fork child process, setup master, will fix error
cluster.setupMaster({
execArgv: []
});
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.
Please reopen this issue and merge the linked PR.
Temporary solution:
https://github.com/vercel/pkg/issues/1047#issuecomment-1293431841