serve icon indicating copy to clipboard operation
serve copied to clipboard

Node.js 22: "[DEP0040] DeprecationWarning: The `punycode` module is deprecated."

Open MikeMcC399 opened this issue 10 months ago • 3 comments

  • This issue follows on from https://github.com/vercel/serve/issues/789

Description

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

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

Node.js v22.0.0 (Current) was released on Apr 24, 2024.

Steps to reproduce

On Ubuntu 22.04.4 LTS with Node.js v22.0.0

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

shows

$ serve -v
(node:4155) [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:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:113:7)
    at Module._load (node:internal/modules/cjs/loader:1053:17)
    at Module.require (node:internal/modules/cjs/loader:1290:19)
    at require (node:internal/modules/helpers:188: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:1455:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1534:10)
14.2.2

Library version

14.2.2 and 14.2.3

Node version

v22.0.0 and v22.5.1

MikeMcC399 avatar Apr 25 '24 06:04 MikeMcC399

  • This issue and https://github.com/vercel/serve-handler/issues/204 need to be resolved before Node.js 22.x enters Active LTS status on Oct 29, 2024 (see Release Schedule). If not, I would plan to migrate away from using serve.

MikeMcC399 avatar May 25 '24 08:05 MikeMcC399

Probably not worth the mention, but yes it's present in node v22.5.0.

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

nemanjacosovic avatar Jul 17 '24 21:07 nemanjacosovic

@nemanjacosovic

I've updated the original posting with the latest versions serve 14.2.3 / Node.js v22.5.1.

MikeMcC399 avatar Jul 30 '24 12:07 MikeMcC399

  • https://github.com/vercel/serve-handler/issues/204 is now resolved. This needs a new release to follow the current latest [email protected] from Nov 2022, as noted in https://github.com/vercel/serve-handler/pull/207#issuecomment-2413436282
  • This would need a change is this repo as well since [email protected] is explicitly called out by [email protected]

https://github.com/vercel/serve/blob/d06104a2de569b1bef57f567f853ab3cfd0024e4/package.json#L47

MikeMcC399 avatar Oct 15 '24 10:10 MikeMcC399

  • See https://github.com/vercel/serve/pull/812 for resolution

MikeMcC399 avatar Oct 15 '24 14:10 MikeMcC399