Since Node 22 you can run the scripts in your package.json without going
through npm at all: node --run build . The pitch is one word β speed. Node's own
documentation does not hide it: the implementation is "intentionally more
limited, in order to focus on top performance for the most common use cases".
Two of those limitations are spelled out in the docs. Two differences that turned
up in today's measurements are not in the docs at all, and the second one is the
surprise: under node --run , the shape of your script decides which exit code
the same death gets. A script that kills itself with SIGKILL returns 0 when it
is a single command and 1 once a true && is put in front of it. Under npm run
that same death is 137 either way β three codes in total, two of them separated
by nothing but syntax.
The cause is a layer neither side documents: node --run hands the command to a
/bin/sh , and whether that shell survives decides the exit code.β¦