Skip to content

Node.js 21: "[DEP0040] DeprecationWarning: The punycode module is deprecated." #789

Closed as not planned
@MikeMcC399

Description

@MikeMcC399

Description

Running serve under Node.js 21.x version causes the following deprecation notice to be displayed:

(node:24848) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)

The message is also shown in response to serve -v.

Node.js v21.0.0 (Current) was released on Oct 17, 2023.

Steps to reproduce

npm install serve -g
export NODE_OPTIONS='--trace-deprecation'
serve -v

shows

added 89 packages in 8s

24 packages are looking for funding
  run `npm fund` for details
(node:4213) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:392:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1001:17)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/mike/n/lib/node_modules/serve/node_modules/fast-url-parser/src/urlparser.js:401:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
14.2.1

https://nodejs.org/dist/latest-v21.x/docs/api/deprecations.html#DEP0040 lists the deprecation and shows that a runtime deprecation was added to Node.js v21.0.0 (see nodejs/node#47202).

Library version

First reported on version: 14.2.1
Still reproducible with version: 14.2.2

Node version

v21.0.0
v21.7.3

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions