Tired of the punycode deprecation message?

Are you tired of seeing this?:

[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:399:…


This content originally appeared on DEV Community and was authored by NullVoxPopuli

Are you tired of seeing this?:

[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:399:7)
     at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
     at loadBuiltinModule (node:internal/modules/helpers:96:7)
     at Module._load (node:internal/modules/cjs/loader:1070:17)
     at TracingChannel.traceSync  
     ...

The "Solve"

Change your start or dev script in package.json to be prefixed with:

NODE_NO_WARNINGS=1

For example,
if you previously had

"start": "vite"

change it to

"start": "NODE_NO_WARNINGS=1 vite"

Now you can enjoy console output with 80,000 less lines of spew.

If you are motivated and have the time, it is beneficial to try to help out packages by either:

  • upgrading them to a version that doesn't trigger the deprecation
  • PR a fix that doesn't trigger the deprecation (uses a userland module, as instructed).

The userland module is here: https://github.com/mathiasbynens/punycode.js

And you can scan all your dependencies for violations (so you don't have to rely on runtime to find every occurrance) with this tool: punycode-detector

npx punycode-detector

or

pnpm dlx punycode-detector

This also works for other tools

For example,
if you previously had

"start": "ember serve"

change it to

"start": "NODE_NO_WARNINGS=1 ember serve"


This content originally appeared on DEV Community and was authored by NullVoxPopuli


Print Share Comment Cite Upload Translate Updates
APA

NullVoxPopuli | Sciencx (2024-08-06T19:43:04+00:00) Tired of the punycode deprecation message?. Retrieved from https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/

MLA
" » Tired of the punycode deprecation message?." NullVoxPopuli | Sciencx - Tuesday August 6, 2024, https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/
HARVARD
NullVoxPopuli | Sciencx Tuesday August 6, 2024 » Tired of the punycode deprecation message?., viewed ,<https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/>
VANCOUVER
NullVoxPopuli | Sciencx - » Tired of the punycode deprecation message?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/
CHICAGO
" » Tired of the punycode deprecation message?." NullVoxPopuli | Sciencx - Accessed . https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/
IEEE
" » Tired of the punycode deprecation message?." NullVoxPopuli | Sciencx [Online]. Available: https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/. [Accessed: ]
rf:citation
» Tired of the punycode deprecation message? | NullVoxPopuli | Sciencx | https://www.scien.cx/2024/08/06/tired-of-the-punycode-deprecation-message/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.