Node DeprecationWarning Treated as Error in CI - Stop the Failing Warning
Node deprecation warnings are advisory by default, but --throw-deprecation upgrades them to thrown errors, so a deprecated API call crashes the job.
What this error means
A CI step exits non-zero on a DeprecationWarning, with a stack rather than a plain warning line, because the process was started with --throw-deprecation.
node
node:internal/process/warning:130
throw warning;
^
DeprecationWarning: The `util.isArray` API is deprecated. Please use
`Array.isArray()` instead.
at emitDeprecationWarning (node:internal/util:80:11)Common causes
--throw-deprecation is enabled
A flag or NODE_OPTIONS in CI turns deprecation warnings into thrown errors, so any deprecated API aborts the run.
Code or a dependency uses a deprecated API
A removed-soon API is still being called, and with throw-on-deprecation that call becomes fatal.
How to fix it
Replace the deprecated API
- Read the warning to identify the deprecated call.
- Switch to the recommended replacement.
- Re-run to confirm the warning no longer fires.
JavaScript
Array.isArray(value); // instead of util.isArray(value)Drop the throw-deprecation flag if intentional warnings remain
- Remove --throw-deprecation from NODE_OPTIONS or the run command.
- Address the underlying deprecated calls separately.
How to prevent it
- Keep --throw-deprecation off in CI unless you are deliberately auditing, fix deprecated API usage promptly, and watch dependency upgrade notes for newly deprecated calls.
Related guides
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 "bad option" Unknown Flag in CI - Fix the Node InvocationFix the Node.js "bad option" unknown-flag error in CI by removing the flag, fixing its spelling, or using a N…
Node UnhandledPromiseRejection Crashes the Job in CI - Handle the RejectionFix Node.js UnhandledPromiseRejection crashes in CI by awaiting or catching the rejecting promise so the proc…