child_process.spawn
, Credits to @jiaji-zhou. Simple, quick, January 2015Environment issues
PATH
environment variable.Windows-only bugs/quirks
Wrong spawn('command', ['--argument', 'list'], { cwd, env, ...opts })
usage
opts.cwd
) does not exist ยท see leeroy-brun's answerString
spawn('command --wrong --argument list')
spawn('ENV_VAR=WRONG command')
Array
specified as String
spawn('cmd', '--argument list')
PATH
env variable spawn('cmd', [], { env: { variable } }
spawn('cmd', [], { env: { ...process.env, variable } }
There are 2 posible origins for
ENOENT
:
- Code you are writing
- Code you depend on
When origin is code you depend on, usual cause is an Environment Issue (or windows quirk)