You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cluster.fork() fails when called in repl (cluster.settings.exec undefined) #35158
Running v14.4, I launched my script with cli dynamic import: node -e 'import("./seed.js").then(({open})=>open());'
and I get the following error on fork process creation:
TypeError [ERR_INVALID_ARG_TYPE]: The "modulePath" argument must be of type string. Received undefined
at validateString (internal/validators.js:121:11)
at fork (child_process.js:63:3)
at createWorkerProcess (internal/cluster/master.js:132:10)
at EventEmitter.cluster.fork (internal/cluster/master.js:167:25)
at file:///media/fuse/drivefs-fb63ac1d072197a08fd8e42d246fd29a/root/www.blikpatrik.net/Blik_2020_seed.js:40:58
at Array.map (<anonymous>)
at file:///media/fuse/drivefs-fb63ac1d072197a08fd8e42d246fd29a/root/www.blikpatrik.net/Blik_2020_seed.js:40:41
in internal/cluster/master.js:132, createWorkerProcess(id,env) function passes cluster.settings.exec down empty to fork(modulePath)
after cluster.setupMaster() has it set from process.argv[1]
(which is empty due to --eval usage)
at internal/cluster/master.js:57.
I see running code dynamically as an equally reasonable use case
for forking processes so i suppose this is not intended.
I wonder if import.meta.url could be utilised for a solution, at least as an optional argument.
changed the title [-]cluster.settings.exec undefined as cluster.fork() argument when called in repl[/-][+]cluster.fork() fails when called in repl (cluster.settings.exec undefined)[/+]on Oct 2, 2020
The solution for me in the meantime has been to set a mock entry point before forking,
which a bit surprisingly doesn't influence the childprocesses
launching with the correct initial command so it works fine. if(!process.argv[1]) process.argv[1]=import.meta.url;
Activity
[-]cluster.settings.exec undefined as cluster.fork() argument when called in repl[/-][+]cluster.fork() fails when called in repl (cluster.settings.exec undefined)[/+]blikest commentedon Oct 2, 2020
The solution for me in the meantime has been to set a mock entry point before forking,
which a bit surprisingly doesn't influence the childprocesses
launching with the correct initial command so it works fine.
if(!process.argv[1])process.argv[1]=import.meta.url;avivkeller commentedon Jun 22, 2026
I don't think there's enough info here for us to make an accurate reproduction