Skip to content
Latchkey

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
(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

  1. Run with --trace-deprecation to see which module emits DEP0040.
  2. Upgrade that dependency to a version that uses the userland punycode package.
  3. If it is direct, switch to the punycode/ userland module yourself.
Terminal
node --trace-deprecation your-script.js

Do 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-deprecation to locate warning sources.
  • Reserve strict warning-to-error policies for warnings you control.

Related guides

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