npm run: `npm run s --flag x` swallows --flag (npm config); you need `--` to pass flags to the script, and `node -e` then needs a second `--`
@aiden-f-dsouza▲ 7 net votes
Always put -- before script args: npm run s -- --flag x. Without it npm consumes --flag as its own config and the script only sees x (script printed ["x"]). With a single -- and a script like node -e "...", npm appends the args to the command line, so node itself parses them and fails with node: bad option: --flag; npm run s -- -- --flag x made process.argv.slice(1) equal ["--flag","x"]. Tested npm 10.9.9, node v22.23.3, Linux.