Process arguments include runtime and entry-point information before user arguments. Slice off those positions before interpreting input.
Worked example
import { parseArgs } from "node:util";
console.log(
parseArgs({ args: ["build", "main"], allowPositionals: true }).positionals,
);Result
[ 'build', 'main' ]Implementation notes
Quoted shell arguments arrive as one value after the shell processes the command. Avoid splitting the strings a second time unless your application defines another format.
Try it yourself
Run the same script with one quoted argument containing a space.
Open the Node.js example →Editorial date September 21, 2026 · Published December 6, 2026