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
MikeMcC399 commented 7 months ago

The issue is also reproducible with yarn add

npm install yarn@1.22.1 -g
mkdir yarn-test
cd yarn-test
yarn init -y
yarn add yarn

displays:

yarn add v1.22.1
info No lockfile found.
[1/4] Resolving packages...
⠁ (node:15052) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ yarn@1.22.21
info All dependencies
└─ yarn@1.22.21
Done in 0.44s.
kayac-chang commented 7 months ago

I also encountered this issue, leave the version here for reference.

Component Version
Yarn (Classic) v1.22.19
Node.js: v21.2.0
MikeMcC399 commented 7 months ago

@kayac-chang Yarn (Classic) v1.22.19 has already been replaced by v1.22.21, so any attention should be focussed on this latest version.

RDIL commented 7 months ago

@MikeMcC399 can you send the output with --trace-deprecation? I'm personally unable to reproduce it on my end.

MikeMcC399 commented 7 months ago

@RDIL

The following is from WSL2 under Windows 11 with a virtual Ubuntu 22.04.3 environment and nvm as Node manager installed:

npm install yarn@latest -g
yarn -v
1.22.21
export NODE_OPTIONS='--trace-deprecation'
yarn info yarn description
yarn info v1.22.21
(node:2652) [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:392:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1001:17)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (/home/mike/.nvm/versions/node/v21.2.0/lib/node_modules/yarn/lib/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/mike/.nvm/versions/node/v21.2.0/lib/node_modules/yarn/lib/cli.js:56536:18)
    at __webpack_require__ (/home/mike/.nvm/versions/node/v21.2.0/lib/node_modules/yarn/lib/cli.js:22:30)
    at Object.<anonymous> (/home/mike/.nvm/versions/node/v21.2.0/lib/node_modules/yarn/lib/cli.js:71815:18)
πŸ“¦πŸˆ Fast, reliable, and secure dependency management.
Done in 0.30s.
Mahi12333 commented 7 months ago

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

ssstheman commented 7 months ago

@Mahi12333 Mahi12333 can you help me with some problem?

root@str-bot01:/# NODE_OPTIONS='--trace-deprecation' yarn info yarn description yarn info v1.22.21 (node:1975) [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:392:7) at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10) at loadBuiltinModule (node:internal/modules/helpers:101:7) at Module._load (node:internal/modules/cjs/loader:1001:17) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (/usr/local/lib/node_modules/yarn/lib/v8-compile-cache.js:159:20) at Object. (/usr/local/lib/node_modules/yarn/lib/cli.js:56536:18) at __webpack_require__ (/usr/local/lib/node_modules/yarn/lib/cli.js:22:30) at Object. (/usr/local/lib/node_modules/yarn/lib/cli.js:71815:18) πŸ“¦πŸˆ Fast, reliable, and secure dependency management. Done in 0.15s. root@str-bot01:/#

shashi-appgolive commented 6 months ago

I m facing same issue while running mongo, this issue resolved ?

MikeMcC399 commented 6 months ago

@shashi-appgolive

I m facing same issue while running mongo, this issue resolved ?

If you are having a problem with mongo then you should probably be referring to their support system https://github.com/mongodb/mongo

MikeMcC399 commented 5 months ago

@RDIL

Were you now able to reproduce? and if so, is there still an intention to fix the issue in Yarn Classic?

gurkulplus commented 5 months ago

I m facing same issue while running mongo, this issue resolved ?

Hi @shashi-appgolive is your issues resolved ? I am also getting this on node 19.9.0 version and mongo 7

shashi-appgolive commented 5 months ago

I m facing same issue while running mongo, this issue resolved ?

Hi @shashi-appgolive is your issues resolved ? I am also getting this on node 19.9.0 version and mongo 7

Nope! Using local docker with mongo image.

luyanda commented 5 months ago

Is there solution to this issue because I can't find one: (node:9272) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. I don't wan to reproduce it I need to solve it.

SeaForeEx commented 5 months ago

I'm seeing that the way to fix this punycode/userland issue in Node is to change const punycode = require('punycode'); to const punycode = require('punycode/');. I have searched my VSCode file and don't even have the original const punycode anywhere in my project. Where would I add this line of code?

MikeMcC399 commented 5 months ago

@SeaForeEx

I'm seeing that the way to fix this punycode/userland issue in Node is to change const punycode = require('punycode'); to const punycode = require('punycode/');. I have searched my VSCode file and don't even have the original const punycode anywhere in my project. Where would I add this line of code?

If you don't have the problem directly in your own code, then the problem would be coming from a module you're using. This issue is about the deprecation caused by Yarn Classic itself. I don't believe that it is possible to patch Yarn as a workaround.

You should be able to see which module(s) have a deprecation issue if you execute:

export NODE_OPTIONS='--trace-deprecation'
yarn

If the deprecation is coming from somewhere else rather than Yarn, then you might be able to patch it. That would however be a subject for the module with the issue.

SeaForeEx commented 5 months ago

Fixed my issue, I was trying to do this in the Front End instead of the Back End, classic amateur move.

RDIL commented 5 months ago

@MikeMcC399 yeah, I was able to reproduce, I have no idea why it's doing that. I'll try to look into it further.

RDIL commented 5 months ago

Update: I spoke with the team, it looks like the cause was already identified and fixed, but has not been released yet.

dhruvsinghal7494 commented 5 months ago

Fixed my issue, I was trying to do this in the Front End instead of the Back End, classic amateur move.

Hi, how you fixed this issue, mine is still not fixed, showing this error in my every project.

JJJ commented 5 months ago

Also still seeing this.

Here's my deprecation output:

β†’ rm -rf node_modules yarn.lock
took 4s

β†’ yarn cache clean
success Cleared cache.
✨  Done in 6.47s.

β†’ node -v
v20.11.0

β†’ nvm use 21

β†’ export NODE_OPTIONS='--trace-deprecation'

β†’ yarn install    
yarn install v1.22.21
info No lockfile found.
[1/4] πŸ”  Resolving packages...
⠁ (node:51023) [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:397:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:333:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1006:17)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:56536:18)
    at __webpack_require__ (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:22:30)
    at Object.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:71815:18)
warning @ava/babel > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning @ava/babel > @babel/plugin-proposal-dynamic-import@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.
warning @ava/babel > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning @ava/babel > empower-core > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @ava/babel > babel-plugin-espower > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @ava/babel > babel-plugin-espower > call-matcher > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @ava/babel > babel-plugin-espower > espurify > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
warning @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning @electron/rebuild > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
[2/4] 🚚  Fetching packages...
error @ava/typescript@4.1.0: The engine "node" is incompatible with this module. Expected version "^14.19 || ^16.15 || ^18 || ^20". Got "21.6.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
took 45s πŸ†—
MikeMcC399 commented 5 months ago

@JJJ

Also still seeing this.

That is to be expected, since this issue is still open. It was however great to read https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1888289602 which said:

Update: I spoke with the team, it looks like the cause was already identified and fixed, but has not been released yet.

so that leads me to believe that if we wait, then the fix will be released in a new patch of Yarn > v1.22.21.

Here's my deprecation output: ⠁ (node:51023) [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:397:7) at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:333:10) at loadBuiltinModule (node:internal/modules/helpers:101:7) at Module._load (node:internal/modules/cjs/loader:1006:17) at Module.require (node:internal/modules/cjs/loader:1237:19) at require (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/v8-compile-cache.js:159:20) at Object. (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:56536:18) at __webpack_require__ (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:22:30) at Object. (/opt/homebrew/Cellar/yarn/1.22.21/libexec/lib/cli.js:71815:18)

This is basically the same stack trace as I posted in https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1823602528.

You then have warnings concerning @ava/babel which you would need to research in their repo. The same for the other similar warnings.

error @ava/typescript@4.1.0: The engine "node" is incompatible with this module. Expected version "^14.19 || ^16.15 || ^18 || ^20". Got "21.6.0" error Found incompatible module.

This error from @ava/typescript says that it is not compatible with Node.js 21. It may prevent your migration to Node.js 21, however this is not a problem that Yarn can help you with.

basiq-ash commented 5 months ago

Facing same issue, is there any update on this?

MikeMcC399 commented 5 months ago

@basiq-ash

Facing same issue, is there any update on this?

The last update is from last week. See https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1888289602

MikeMcC399 commented 5 months ago

The issue is also reproducible if Yarn Classic is used to set the version to Yarn Modern:

nvm use 21
corepack disable
npm install yarn -g
yarn set version stable
$ yarn set version stable
(node:30812) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
➀ YN0000: Retrieving https://repo.yarnpkg.com/4.0.2/packages/yarnpkg-cli/bin/yarn.js
➀ YN0000: Saving the new release in .yarn/releases/yarn-4.0.2.cjs
➀ YN0000: Done in 0s 615ms
noxidsoft commented 5 months ago

The issue is reproducible using npm run serve.

I'm on: OS: Ubuntu 20.04.6 LTS on Windows 10 x86_64 Kernel: 5.15.133.1-microsoft-standard-WSL2

npm --version 10.3.0

node --version v21.6.1

(node:47931) [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 TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function

I am not using a reference in my code.

MikeMcC399 commented 5 months ago

@noxidsoft

npm run serve

Your comment is in the wrong repository, since this issue is about Yarn, not npm, and the problem with the npm module serve is caused by one of its dependencies. It is not caused by Yarn (which you are not using).

Hadi90fe commented 4 months ago

I m facing same issue

Component Version
Yarn (Classic) v1.22.19
Node.js: v21.6.1
Mohammed-Aljasem commented 4 months ago

Facing the same issue, is there any update on this?

emreakdas commented 4 months ago

same issue

OzzyCzech commented 4 months ago

same here

jigglypop commented 4 months ago

same here

MikeMcC399 commented 4 months ago

If you want to register that you are also interested in a resolution for this issue, I suggest you "up-vote" it by clicking on the πŸ‘πŸ» icon in the original post https://github.com/yarnpkg/yarn/issues/9013#issue-1996377374 instead of adding a separate new comment:

image

MikeMcC399 commented 4 months ago

@RDIL

You wrote in https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1888289602 back in January that the issue was fixed and not yet released. Can you share any planning date for a potential release?

RDIL commented 4 months ago

I don't honestly know. It's not up to me, and Yarn Classic is deprecated in favor of Berry, and is currently only getting high priority updates. I understand that it's not possible in all cases but I highly recommend migrating if you are able.

I'll try to bump this again but I can't guarantee anything.

MikeMcC399 commented 4 months ago

@RDIL

Many thanks for your attention to this! I do appreciate that Yarn Classic is deprecated and in terms of using Yarn Classic as a standalone item I would understand if this issue were designated as "won't fix".

I would be more concerned about the use of Yarn Classic in order to set up Yarn Berry (Modern) which provokes the punycode warning. Perhaps this is then more of an issue which needs to be transferred to Yarn Berry?

https://yarnpkg.com/getting-started/install says

The preferred way to manage Yarn is by-project and through Corepack, a tool shipped by default with Node.js. Modern releases of Yarn aren't meant to be installed globally, or from npm.

This is however slightly problematic as Node.js Corepack documentation classifies Corepack with Stability: 1 Experimental and the Node.js documentation says "Use of the feature is not recommended in production environments."

So the choice is between the devil and the deep-blue sea in Node.js 21 environments:

JhiNResH commented 4 months ago

I'm writing with some solana spl token, and faced this issue,too.

(node:10501) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Oops, something went wrong: TokenAccountNotFoundError
MikeMcC399 commented 4 months ago

@JhiNResH

Did you run your command using the --trace-deprecation option to check which module(s) cause the warning?

JhiNResH commented 4 months ago

@JhiNResH

Did you run your command using the --trace-deprecation option to check which module(s) cause the warning?

It did not show any modules that cause the warning

stefanrows commented 4 months ago

@JhiNResH same here.

Still getting the error on 21.6.2

cba85 commented 4 months ago

Same here! Node 21.6.2

Debug information

(node:46025) [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:397:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:333:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1006:17)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/clem/dev/wip-telegram-timeline/node_modules/psl/index.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Module._load (node:internal/modules/cjs/loader:1028:12)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/clem/dev/wip-telegram-timeline/node_modules/tough-cookie/lib/pubsuffix-psl.js:32:11)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Module._load (node:internal/modules/cjs/loader:1028:12)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/clem/dev/wip-telegram-timeline/node_modules/tough-cookie/lib/cookie.js:35:17)
MikeMcC399 commented 3 months ago

@cba85

Your deprecation trace shows also warnings associated with

Those warnings are off topic for this issue however.

cba85 commented 3 months ago

@cba85

Your deprecation trace shows also warnings associated with

Those warnings are off topic for this issue however.

Thank you, I will check those links πŸ‘

arcanis commented 3 months ago

Fixed with the 1.22.22:

❯ corepack yarn@1.22.21 info

yarn info v1.22.21
(node:35285) [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 Received invalid response from npm.
✨  Done in 0.80s.

❯ corepack yarn@1.22.22 info

yarn info v1.22.22
error Received invalid response from npm.
✨  Done in 0.09s.
dmz006 commented 3 months ago

Fixed with the 1.22.22:

❯ corepack yarn@1.22.21 info

yarn info v1.22.21
(node:35285) [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 Received invalid response from npm.
✨  Done in 0.80s.

❯ corepack yarn@1.22.22 info

yarn info v1.22.22
error Received invalid response from npm.
✨  Done in 0.09s.

What is the easiest way to test this fix?

MikeMcC399 commented 3 months ago

@arcanis Many thanks for releasing this fix! πŸ‘πŸ»

Testing according to the original repro steps confirms the fix is working as needed: πŸŽ‰

Repro steps

Confirm that Node.js 21.x is installed / active

$ node -v
v21.7.1

Install previous version of Yarn (1.22.21) and confirm that the deprecation warning appears:

$ npm install yarn@1.22.21 -g

added 1 package in 959ms

$ yarn info yarn description
yarn info v1.22.21
(node:25088) [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 0.21s.

Install latest version of Yarn (1.22.22) and confirm that the deprecation warning no longer appears

$ npm install yarn@latest -g

changed 1 package in 459ms

$ yarn info yarn description
yarn info v1.22.22
πŸ“¦πŸˆ Fast, reliable, and secure dependency management.
Done in 0.20s.
MikeMcC399 commented 3 months ago

Also confirmed fixed for yarn set version stable with corepack disabled:

Repro steps

Confirm that Node.js 21.x is installed / active

$ node -v
v21.7.1

Install previous version of Yarn (1.22.21) and confirm that the deprecation warning appears:

$ corepack disable

$ npm install yarn@1.22.21 -g

changed 1 package in 604ms

mikem@DESKTOP-J2IBBHJ MINGW64 /d/github2/yarn-install
$ yarn set version stable
(node:7044) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
➀ YN0000: You don't seem to have Corepack enabled; we'll have to rely on yarnPath instead
➀ YN0000: Downloading https://repo.yarnpkg.com/4.1.1/packages/yarnpkg-cli/bin/yarn.js
➀ YN0000: Saving the new release in .yarn/releases/yarn-4.1.1.cjs
➀ YN0000: Done with warnings in 0s 252ms

Install latest version of Yarn (1.22.22) and confirm that the deprecation warning no longer appears

$ npm install yarn@latest -g

changed 1 package in 440ms

mikem@DESKTOP-J2IBBHJ MINGW64 /d/github2/yarn-install
$ yarn set version stable
➀ YN0000: Downloading https://repo.yarnpkg.com/4.1.1/packages/yarnpkg-cli/bin/yarn.js
➀ YN0000: Saving the new release in .yarn/releases/yarn-4.1.1.cjs
➀ YN0000: Done in 0s 459ms
MikeMcC399 commented 3 months ago

@dmz006

What is the easiest way to test this fix?

See my previous comments https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1987106314 and https://github.com/yarnpkg/yarn/issues/9013#issuecomment-1987108485

That does not cover all possible scenarios, however I'm confident that the issue has been fixed now as far as core Yarn is concerned.

bennettfrazier commented 2 months ago

@arcanis Many thanks for releasing this fix! πŸ‘πŸ»

Testing according to the original repro steps confirms the fix is working as needed: πŸŽ‰

Repro steps

Confirm that Node.js 21.x is installed / active ... Install previous version of Yarn (1.22.21) and confirm that the deprecation warning appears: $ npm install yarn@1.22.21 -g ... Install latest version of Yarn (1.22.22) and confirm that the deprecation warning no longer appears ... $ npm install yarn@latest -g

@MikeMcC399 Thanks for the steps to reproduce.

I followed these steps, but still getting a punycode DeprecationWarning message.

MikeMcC399 commented 2 months ago

@bennettfrazier

The most likely reason that you are still getting a punycode deprecation message is that it is coming from a package which is not Yarn. Have you set the environment variable export NODE_OPTIONS='--trace-deprecation' (or similar depending on your operating system and terminal type) and run your command to get trace information?

aryankarim commented 2 months ago

@MikeMcC399

I use node: v21.6.2 and yarn: 1.22.22.

Then I ran building NextJS v.14.2.1 with yarn build with --trace-deprecation

Here is the result:

(node:24279) [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:397:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:333:10)
    at loadBuiltinModule (node:internal/modules/helpers:101:7)
    at Module._load (node:internal/modules/cjs/loader:1006:17)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    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)