You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tesseract.js version (version number for npm/GitHub release, or specific commit for repo)
5.0.4
Describe the bug
When updating to node v21 this node warning comes up when using packages that rely on node's built in punycode module. (node:15352) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
This module can be traced back to an old version of tr46 which itself is used in an old version of whatwg-url which itself is used in an old version of node-fetch.
tr46 already fixed that issue and newer versions of whatwg-url don't have the same issue and as far as I can tell the latest node-fetch version doesn't even use whatwg-url in the first place.
Long story short, would you consider updating to a newer version of node-fetch?
To Reproduce
Steps to reproduce the behavior:
Update node to v21
run project using tesseract.js
See error
Device Version:
OS + Version: Windows 11 22H2
Node v21.6
The text was updated successfully, but these errors were encountered:
Balearica
changed the title
regarding the punycode deprecation warning
Fix punycode deprecation warning
Jan 22, 2024
Thanks for looking into this. I looked into whether it is possible to remove this warning message by bumping the version of node-fetch, however I do not believe it is. Tesseract.js uses v2 of node-fetch.
According to this issue, the depreciation warning is still an issue for the latest v2 release of node-fetch
According to this documentation, using v3 of node-fetch would not be possible without adapting the project to use ESM modules rather than CommonJS
The documentation states "We recommend you stay on v2 which is built with CommonJS unless you use ESM yourself. We will continue to publish critical bug fixes for it."
Therefore, I believe this warning will continue until either (1) there is v2 release of node-fetch that resolves it or (2) Tesseract.js switches to ESM modules. The latter will probably happen in the next major version, however is currently not a priority for me.
Thank you, next major version sounds good enough.
For now I fixed it manually by going down the module tree and modifying the old version of tr46 and whatwg-url directly to use the userland punycode module.
Tesseract.js version (version number for npm/GitHub release, or specific commit for repo)
5.0.4
Describe the bug
When updating to node v21 this node warning comes up when using packages that rely on node's built in punycode module.
(node:15352) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
This module can be traced back to an old version of
tr46
which itself is used in an old version ofwhatwg-url
which itself is used in an old version ofnode-fetch
.tr46 already fixed that issue and newer versions of whatwg-url don't have the same issue and as far as I can tell the latest node-fetch version doesn't even use whatwg-url in the first place.
Long story short, would you consider updating to a newer version of node-fetch?
To Reproduce
Steps to reproduce the behavior:
Device Version:
The text was updated successfully, but these errors were encountered: