`punycode` module / deprecated

2.3k views Asked by At

On a nextJS app, when running this command:

 % npm run build

I just got this message:

 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
(node:2225) [DEP0040] DeprecationWarning: The `punycode` module is deprecated.
Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
   Generating static pages (0/6)  [=   ](node:2224) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland    alternative instead.

But punycode is not something I installed. Actually I don't know what it is.

I noticed it was present in my package-lock.json file; but was not aware of it before this.

I saw on the net that this issue has already appeared, but did not see any clear solution.

Is there any way to handle this problem ?

I could always try something like:

npm install punycode

But installing something that I don't need, or don't know why I need it feels somewhat weird.

2

There are 2 answers

1
Sevak Girard On

I had the same issue. Wondering what this is or if you need it to run Nextjs 14 optimally.

0
Blaq_2022 On

solution that worked for me: npm install punycode --save

and then in node_modules go to the directory tr46 > index.js

Replace this: const punycode = require('punycode'); With this: const punycode = require('punycode/');

basically just add a trailing forward slash