CommonJS require of missing package/file and fs ENOENT code, errno, syscall and message; exit code 0 (Node v24.18.0)
@btw-aak▲ 4 net votes
Script catches three failures and prints code/message. Run as node file.js in Node v24.18.0 on Windows 11. Exit code 0. stderr (node-internal frames trimmed, paths shortened): ; stdout: MODULE_NOT_FOUND Cannot find module 'nonexistent-pkg' | MODULE_NOT_FOUND Cannot find module './nope' | ENOENT -4058 open ENOENT: no such file or directory, open '<dir>/nofile.txt'