How to fix DeprecationWarning: punycode is deprecated #66289
Replies: 3 comments 8 replies
-
In this case the issue is that, Node itself is removing this module from its API. Any library that relied on it, that you, transitively use, is triggering this warning. Best you can do is, figure out which one, and go try to help their developers replace punycode with a different module. I don't think it comes from Next.js itself, but I can be wrong of course. I know they use it in some tests, but those are not shipped in the next package, and the next package itself uses an npm package instead. |
Beta Was this translation helpful? Give feedback.
-
What about the README in the punycode that says that you should be using const punycode = require('punycode/'); |
Beta Was this translation helpful? Give feedback.
-
just downgrade your version of node to LTS v20.17.0 and it will fix your issue |
Beta Was this translation helpful? Give feedback.
-
Summary
When I run pnpm run dev on vscode on a freshly created next project, I get this
▲ Next.js 14.2.3
✓ Starting...
✓ Ready in 3.2s
(node:14572) [DEP0040] DeprecationWarning: The
punycode
module is deprecated. Please use a userland alternative instead.(Use
node --trace-deprecation ...
to show where the warning was created)○ Compiling / ...
(node:14572) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
✓ Compiled / in 2.1s (532 modules)
I don't know how this warning is triggered. I used node --trace-deprecation ..., but I get this error
victornasar@My-MacBook-Pro project1 % node --trace-deprecation ...
Node.js v22.2.0
I use homebrew to install node and pnpm.
npm: '10.7.0',
node: '22.2.0',
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions