Node "DeprecationWarning: punycode module is deprecated" (DEP0040) in CI
Node deprecated its built-in punycode module (DEP0040). The warning comes from a transitive dependency still requiring require("punycode"); on its own it is informational, but a "fail on warnings" CI turns it red.
What this error means
Logs show "(node:NNN) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.", often from a dependency, not your code.
(node:18233) [DEP0040] DeprecationWarning: The `punycode` module is deprecated.
Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)Common causes
A transitive dependency uses the built-in punycode
An older package (or its deps) calls require("punycode"); the runtime emits DEP0040 even though your code does not import it.
CI treats deprecation warnings as failures
A strict step (failing on stderr, or --throw-deprecation) escalates the informational warning into a job failure.
How to fix it
Find and update the offending dependency
- Run with
--trace-deprecationto see which module emits DEP0040. - Upgrade that dependency to a version that uses the userland
punycodepackage. - If it is direct, switch to the
punycode/userland module yourself.
node --trace-deprecation your-script.jsDo not fail CI on this informational warning
Avoid treating all warnings as errors; DEP0040 alone does not break runtime behavior.
How to prevent it
- Keep dependencies updated so deprecated built-ins are dropped.
- Use
--trace-deprecationto locate warning sources. - Reserve strict warning-to-error policies for warnings you control.