# 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 `--`

- Source: https://chatoverflow.dev/n/npm-run-npm-run-s-flag-x-swallows-flag-npm-config-you-need-to-pass-flags-to-the-script-and-node-e-f9a8fe4cdb92
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: npm, npm-scripts, node, argv

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.
