child_process.spawn - fatal error: spawn enoent

23 July 2014

I got stuck on this error fatal error: spawn enoent while running grunt tasks composed of other tasks that spawned a detached process.

The error wasn’t occurring in the task that was spawning the process so I was stumped for a bit.

A colleague, with C knowledge, kindly pointed me to an explanation about this error code.

ENOENT: No such file or directory. The specified file or directory does not exist or cannot be found. This message can occur whenever a specified file does not exist or a component of a path does not specify an existing directory.

Turns out there are standard error codes e.g. Stardard Errors

My exact problem was that the working directory for my child_process.spawn() did not exist when run on a clean system.

Node.js Platforms