Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. #2925

Closed
cduff opened this issue Oct 31, 2024 · 4 comments · Fixed by #2947

Comments

@cduff
Copy link

cduff commented Oct 31, 2024

Using @react-pdf/renderer@4.0.0 with node 22.11.0 results in the following console output:

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

Using --trace-deprecation gives me:

at Object.<anonymous> (C:\project\node_modules\node-fetch\node_modules\whatwg-url\lib\url-state-machine.js:2:18)

And then npm list node-fetch gives me:

app-server@ C:\project
└─┬ @react-pdf/renderer@4.0.0
  └─┬ @react-pdf/font@3.0.0
    └─┬ cross-fetch@3.1.8
      └── node-fetch@2.7.0
@jpainam
Copy link

jpainam commented Oct 31, 2024

This is not related to this package. See here yarnpkg/yarn#9005

@cduff
Copy link
Author

cduff commented Nov 1, 2024

Thanks for your comment @jpainam, but I'm not sure how this relates to yarn?

From what I can work out it's caused by @react-pdf/font depending on cross-fetch which has this issue - it relies on an old version of node-fetch which causes the punycode deprecation warning. I tested the latest version of node-fetch and it no longer causes the punycode warning.

Unfortunately, it looks like the latest version of cross-fetch (v4.0.0) still has this issue as it still depends on an old version (v2.7.0) of node-fetch.

So, options for @react-pdf/font would be to either:

@florianbepunkt
Copy link

Is there a need for cross-fetch at all? Current LTS versions of node support native fetch.

@diegomura
Copy link
Owner

Good point. Will drop cross-fetch usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants