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 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.
GitHub Actions
- 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.
Related guides
Node --experimental-vm-modules Required for ESM Tests in CI - Enable the FlagFix Jest ESM failures in CI that demand node --experimental-vm-modules by enabling the flag through NODE_OPTI…
Node "ExperimentalWarning: --loader is deprecated" in CI - Switch to --importFix the Node.js "--loader is deprecated" experimental warning in CI by moving to the --import flag with modul…
Node "The engine 'node' is incompatible" at Runtime in CI - Align Node VersionsFix the "engine node is incompatible" error in CI by pinning the CI Node version to satisfy the engines field…