Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSchild_process spawningSingle-choice MCQ

Why does this spawn call throw ENOENT even though the command exists in the shell, and what is the simplest fix?

const { spawn } = require('node:child_process'); spawn('ls -la | grep js');