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

[CLI] DeprecationWarning: The punycode module is deprecated. #10992

Open
Philipp91 opened this issue Sep 7, 2024 · 5 comments · May be fixed by #11074
Open

[CLI] DeprecationWarning: The punycode module is deprecated. #10992

Philipp91 opened this issue Sep 7, 2024 · 5 comments · May be fixed by #11074
Assignees
Labels
bug It's a bug desktop All desktop platforms high High priority issues v3.1

Comments

@Philipp91
Copy link
Contributor

Operating system

Linux

Joplin version

3.0.1

Desktop version info

No response

Current behaviour

$ joplin version

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

Copyright © 2016-2024 Laurent Cozic
joplin 3.0.1 (prod, linux)

Expected behaviour

No warning.

Logs

With --trace-deprecation:

(node:105403) [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:398:7)
at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
at loadBuiltinModule (node:internal/modules/helpers:96:7)
at Module._load (node:internal/modules/cjs/loader:1063:17)
at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
at Module.require (node:internal/modules/cjs/loader:1297:12)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (/home/philipp/.nvm/versions/node/v22.3.0/lib/node_modules/joplin/node_modules/markdown-it/lib/index.js:14:20)
at Module._compile (node:internal/modules/cjs/loader:1460:14)

The solution should be to update to markdown-it v14 (markdown-it/markdown-it@beed9ae).

@Philipp91 Philipp91 added the bug It's a bug label Sep 7, 2024
@laurent22 laurent22 added desktop All desktop platforms high High priority issues v3.1 labels Sep 7, 2024
@pedr
Copy link
Collaborator

pedr commented Sep 13, 2024

We could upgrade markdown-it version, but there seem to be a lot of dependencies that still would cause the warning.

When I upgraded markdown-it I discovered that whatwg-url@"<9.0" also uses punycode, which is used by node-fetch@"<3.0.", which is an indirect and direct dependency by a lot of libraries like sqlite3, canvas, tesserac, turndown-attendant, to name a few. Try: npm why whatwg-url@"<9.0.0"

The warning is showing up for Node >=21, 22 becomes LTS at the end of the year.

Should we look into upgrading only the direct dependencies that use something that was using the native punycode or maybe find a way to hide the warning when running the joplin bin for app-cli? @laurent22

@laurent22
Copy link
Owner

Is there any other way to disable this warning? I know there's an env variable that can be set - but whatever is being done, can it be done at the application level?

@pedr
Copy link
Collaborator

pedr commented Sep 16, 2024

Is there any other way to disable this warning? I know there's an env variable that can be set - but whatever is being done, can it be done at the application level?

We would need to run the joplin build with something like NODE_OPTIONS=--no-deprecation node main.js, I tried some methods but I couldn't find a way yet.

Node has the process.noDeprecation but it is a read-only property https://nodejs.org/api/process.html#processnodeprecation

@pedr
Copy link
Collaborator

pedr commented Sep 16, 2024

I think maybe we could add dotenv to app-cli project, I'm not sure if this is going to work, but I will try this strategy next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues v3.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants