yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.37k stars 2.72k forks source link

"[DEP0040] The `punycode` module is deprecated" with Node.js 21.x (Rev 2) #9013

Closed MikeMcC399 closed 3 months ago

MikeMcC399 commented 7 months ago

Description

yarn info

provokes a deprecation warning under Node.js current version 21.x.

[DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.

Versions

Component Version
Yarn (Classic) v1.22.21
Node.js: v21.2.0 v21.6.2

Steps to reproduce

With Node.js v21.2.0 v21.6.2 installed, execute:

npm install yarn@latest -g
yarn info yarn description

shows

$ npm install yarn -g
changed 1 package in 909ms
$ yarn info yarn description
yarn info v1.22.21
(node:19052) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
📦🐈 Fast, reliable, and secure dependency management.
Done in 1.06s.

Further debug information is output by:

 NODE_OPTIONS='--trace-deprecation' yarn info yarn description
RDIL commented 2 months ago

@aryankarim

at mod.require (/home/UserOne/Desktop/next-test/node_modules/next/dist/server/require-hook.js:65:28) at require (node:internal/modules/helpers:176:18) at 477 (/home/UserOne/Desktop/next-test/node_modules/next/dist/compiled/node-fetch/index.js:1:104564) at __nccwpck_require__ (/home/UserOne/Desktop/next-test/node_modules/next/dist/compiled/node-fetch/index.js:1:453905)

that's not yarn, that's node-fetch bundled within Next

aryankarim commented 2 months ago

that's not yarn, that's node-fetch bundled within Next

You're right. I've checked node-fetch's github, they're working on it.

But I still got the warning even with yarn info yarn description

However, this upgrade fixed it.

$ npm install yarn@latest -g

JaysonCielo commented 2 months ago

I don't know what this error node:404) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)

note my project still can run then I tried to search and found this thread

also I found this on node modules site

https://nodejs.org/api/punycode.html#:~:text=The%20punycode%20module%20is%20a%20third%2Dparty%20dependency%20used%20by,be%20directed%20to%20the%20Punycode.

can anyone explain what is meaning of errors how this can affect my project in the future?

Information:

Node Version: 21.7.2 Yarn version: v1.22.22 Gatsby Version: 5.13.3

My Project built with GatsbyJS on top of ReactJS using Typescript framework

Steps to reproduce

running cmd "yarn start" or "yarn build"

shows:

PS C:\Users\website> node -v
v21.7.2 PS C:\Users\website> yarn info yarn info v1.22.22 error Received invalid response from npm. Done in 1.15s. PS C:\Users\website> yarn start yarn run v1.22.22 $ gatsby develop -H 0.0.0.0

ERROR UNKNOWN

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

ERROR UNKNOWN

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

⠸ compile gatsby files

ERROR UNKNOWN

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

success compile gatsby files - 5.104s success load gatsby config - 0.100s success onPreInit - 0.012s
success initialize cache - 0.062s success copy gatsby files - 0.249s success Compiling Gatsby Functions - 0.749s success onPreBootstrap - 0.799s success createSchemaCustomization - 0.025s success Clean up stale nodes - 0.050s - 188/0 0.00/s success Checking for changed pages - 0.001s
success source and transform nodes - 1.100s
success building schema - 0.182s success createPages - 0.003s
success createPagesStatefully - 0.752s info Total nodes: 931, SitePage nodes: 59 (use --verbose for breakdown)
success Checking for changed pages - 0.002s
success write out redirect data - 0.002s success Build manifest and related icons - 0.289s success onPostBootstrap - 0.295s info bootstrap finished - 16.305s
success onPreExtractQueries - 0.004s

ERROR UNKNOWN

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

ERROR UNKNOWN

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

ERROR UNKNOWN

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

ERROR UNKNOWN

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

ERROR UNKNOWN

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

ERROR UNKNOWN

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

ERROR UNKNOWN

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

(Use node --trace-deprecation ... to show where the warning was created)

ERROR UNKNOWN

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

ERROR UNKNOWN

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

success extract queries from components - 4.262s success write out requires - 0.063s ⠦ Building development bundle ⠀ You can now view website in the browser. ⠀ Local: http://localhost:8000/ On Your Network: http://192.168.9.128:8000/ ⠀ View GraphiQL, an in-browser IDE, to explore your site's data and schema ⠀ Local: http://localhost:8000/___graphql On Your Network: http://192.168.9.128:8000/___graphql ⠀ Note that the development build is not optimized. To create a production build, use gatsby build ⠀ success Building development bundle - 11.453s success Writing page-data.json and slice-data.json files to public directory - 0.895s - 1/1 1.12/s success write out requires - 0.028s

leo-milao commented 2 months ago

C:\Users\leo-m\source\repos\dc-monitor>node index.js run (node:17192) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) node-tesseract: Running 'tesseract C:\Users\leo-m\source\repos\dc-monitor/input.jpg C:\Users\leo-m\AppData\Local\Temp\tmp-171926WjMVf1O4q1n -l eng -psm 6' node-tesseract: Running 'tesseract C:\Users\leo-m\source\repos\dc-monitor/input.jpg C:\Users\leo-m\AppData\Local\Temp\tmp-17192YfR8OTZ1gjiF -l eng -psm 6' node-tesseract: Deleting 'C:\Users\leo-m\AppData\Local\Temp\tmp-17192YfR8OTZ1gjiF.txt' node-tesseract: Preprocessor cleanup node-tesseract: Deleting 'C:\Users\leo-m\AppData\Local\Temp\tmp-171926WjMVf1O4q1n.txt' node-tesseract: Preprocessor cleanup

RDIL commented 2 months ago

Going to be locking this issue because of the influx of comments that are not caused by Yarn. If anyone is able to reproduce this bug as a direct result of Yarn (using --trace-deprecation) on the new fixed version, please open a new issue. Thanks.