Drop dependency on uri-js/punycode
What version of Ajv you are you using?
v6.12.6
What problem do you want to solve?
Logs being flooded with deprecation warnings:
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
What do you think is the correct solution to problem?
- Drop Node.js support outside of LTE
- Drop uri-js (which depends on punycode)
Will you be able to implement it?
Yes
Related issues:
- https://github.com/garycourt/uri-js/issues/94
Note:
- My understanding is that the only reason for uri-js is backwards compatibility for older Node.js versions.
Also happens in newer version "ajv": "^8.12.0" https://github.com/ajv-validator/ajv/issues/2350
I've opened a PR to fix this in uri-js, the package ajv depends on here: https://github.com/garycourt/uri-js/pull/95
uri-js is no longer being maintained, so there's not a great chance of it being fixed upstream.
You can also nvm install 20 && nvm use 20 to go back to Node v20.11.1 and silence it for now until ajv/eslint/etc update their dependencies
Hi there, I created a replacement for library uri-js as temporal solution.
- Based on Node.js and browser URL api
- 99% compatible with original URI.js library
- Solves "The punycode module is deprecated" warning in Node
- Tested with libraries: ESLint, Webpack, Ajv (runned all Ajv tests)
https://github.com/andreinwald/uri-js-replace
You can add to package.json of your project:
"overrides": {
"uri-js": "npm:uri-js-replace"
}
how progress of this?
seems this exists: https://www.npmjs.com/package/toad-uri-js
can this be done? it's really annoying to see when using eslint.
alternativel,y andreinwald's one can be used. i just found this asweel
We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.
what's the progress on this? @jasoniangreen Is there another issue we can follow to know the progress?
do we have any progress? 🤗
Using eslint that is dependent on ajv and I get alot of these deprecation warnings — which is really annoying.
Really looking forward for this to be solved...
+1
+1
+1
+1
Any progress on this?
+1
+1
+1
Release v8.17.1 has removed uri-js
As indicated by @jasoniangreen, version 8.17.1 of ajv is no longer dependent on punycode. If you're using eslint, you can add the following to your package.json.
// pnpm
{
"pnpm": {
"overrides": {
"ajv": "8.17.1"
}
}
}
// terminal pnpm install
This will force eslint to use the newer version of "ajv".
So, guess that means that for yarn 4.5+ I need to do?
{
"resolutions": {
"ajv": "8.17.1"
}
}
will try it out soon…
Any ETA? Still Warning
We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.
is there another PR/etc we can follow to see this progress? still seeing this error today - while this was closed in June
We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.
is there another PR/etc we can follow to see this progress? still seeing this error today - while this was closed in June
If you're like me then you're seeing this error because you're using a package that relies on node:punycode (not an npm version of punycode).
Try to find the root cause in your case by running node --trace-deprecation
For instance, when I ran this it turned out my issue was node-fetch which relies on node:punycode <-- that's the actual deprecated version.