Skip to content

The punycode deprecation trace is not useful #61901

@glenjamin

Description

@glenjamin

Version

v24.13.1

Platform

Darwin <hostname> 24.6.0 Darwin Kernel Version 24.6.0: Wed Nov  5 21:34:00 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T8132 arm64

Subsystem

No response

What steps will reproduce the bug?

In a project that uses punycode somewhere.

NODE_OPTIONS='--trace-deprecation' npm t

or more concretely (although obviously in this case it's trivial to identify the source):

npm init -y
npm i psl@1.8.0
node --trace-deprecation -e 'require("psl")'

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

I would expect a trace telling me which package/file is requiring punycode

What do you see instead?

What I actually get is

(node:49440) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:7:10
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:125:7)
    at loadBuiltinWithHooks (node:internal/modules/cjs/loader:1195:15)
    at Module._load (node:internal/modules/cjs/loader:1285:48)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
    at Module.require (node:internal/modules/cjs/loader:1548:12)
    at require (node:internal/modules/helpers:152:16)

Additional information

I note that #56632 will reduce the number of times this warning appears, so perhaps that's good enough - but in general it seems reasonable to say that using --trace-deprecation should actually trace the usage of deprecated code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions