Skip to content
Latchkey

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
node: bad option: --experimental-strip-types
$ exit status 9

Common 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

  1. Set the CI Node version to one that recognizes the flag.
  2. Re-run so the option is accepted.
GitHub Actions
- uses: actions/setup-node@v4
  with:
    node-version: 22

Fix or remove the flag

  1. Correct the flag spelling, or drop it if it is not needed.
  2. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →