Node "bad option" Unknown Flag in CI - Fix the Node Invocation
node: bad option means Node was launched with a flag it does not recognize, often a typo or a newer flag passed to an older Node in CI.
What this error means
A node invocation in CI exits immediately with node: bad option: <flag>, frequently because NODE_OPTIONS or the command line includes a flag the runner Node does not support.
node: bad option: --experimental-strip-types
$ exit status 9Common causes
A flag newer than the CI Node version
A flag added in a later Node release is passed to an older runner Node that does not know it.
A typo in a flag or NODE_OPTIONS
A misspelled flag, or one Node does not allow in NODE_OPTIONS, is rejected as a bad option.
How to fix it
Pin a Node version that supports the flag
- Set the CI Node version to one that recognizes the flag.
- Re-run so the option is accepted.
- uses: actions/setup-node@v4
with:
node-version: 22Fix or remove the flag
- Correct the flag spelling, or drop it if it is not needed.
- Confirm the flag is allowed in NODE_OPTIONS when set there.
How to prevent it
- Keep CI Node versions aligned with the flags your scripts need, validate NODE_OPTIONS contents, and only use flags the pinned Node version supports.