How to Fix: Node 22.9.0: The `util._extend` API is deprecated
Node 22.9.0 surfaces a deprecation warning that many Next.js developers did not see before: util._extend is deprecated. The app usually still runs, but every dev-server start prints noise to the terminal, making it clear that one of your dependencies is still calling a legacy Node API that should no longer be used.
Understanding the Root Cause
This warning appears because Node.js 22.9.0 tightened visibility around the legacy util._extend API. That method has been considered deprecated for a long time, but newer Node versions now make the warning much more noticeable during local development.
The important detail is that your application code is usually not the real problem. In most cases, the warning comes from a dependency somewhere in the chain used by Next.js, your build tooling, or a library loaded at startup. Older packages used util._extend as a lightweight object merge helper, but modern JavaScript replaced that pattern with safer and clearer alternatives like Object.assign() or the object spread operator.
So the bug happens for this reason:
- A package in your dependency tree still calls util._extend.
- Node 22.9.0 reports that usage as deprecated.
- Starting the Next dev server loads that package, which triggers the terminal warning.
If you want to confirm the exact source, run Node with trace warnings enabled. That prints the stack trace for the deprecation and points to the package responsible.
Step-by-Step Solution
The fix is not to silence Node blindly. The correct approach is to identify the package, upgrade it if possible, and only use a temporary workaround if the ecosystem has not caught up yet.
1. Reproduce the warning with a stack trace
Run your development server with trace deprecations enabled:
NODE_OPTIONS="--trace-deprecation" next dev
If you use npm scripts:
NODE_OPTIONS="--trace-deprecation" npm run dev
On Windows PowerShell:
$env:NODE_OPTIONS="--trace-deprecation"; npm run dev
This should print a stack trace showing which dependency calls util._extend.
2. Check which package is outdated
Once you have the stack trace, inspect your installed versions:
npm ls
Or for a specific package:
npm ls <package-name>
If you use pnpm:
pnpm why <package-name>
If you use Yarn:
yarn why <package-name>
Look for older tooling libraries, request/parsing libraries, or nested transitive dependencies that have not been updated for modern Node releases.
3. Upgrade direct dependencies first
Update your top-level packages, especially Next.js, build tools, linters, and custom server-related packages:
npm update
Or explicitly upgrade major framework packages:
npm install next@latest react@latest react-dom@latest
If the warning comes from a known direct dependency, upgrade that package directly:
npm install <package-name>@latest
Then reinstall cleanly to avoid stale lockfile issues:
rm -rf node_modules package-lock.json .next
npm install
4. Patch or override a transitive dependency
If the deprecated call comes from a nested dependency you do not import directly, use package manager overrides while waiting for an upstream fix.
For npm:
{
"overrides": {
"<package-name>": "<fixed-version>"
}
}
For pnpm:
{
"pnpm": {
"overrides": {
"<package-name>": "<fixed-version>"
}
}
}
For Yarn:
{
"resolutions": {
"<package-name>": "<fixed-version>"
}
}
After adding the override, reinstall dependencies:
npm install
5. If the deprecated code is in your own project, replace it
If the trace points to your own code, replace util._extend with a modern equivalent.
Old code:
const util = require('util');
const result = util._extend(target, source);
Recommended replacement:
const result = Object.assign(target, source);
Or if you want a new object instead of mutating the target:
const result = { ...target, ...source };
This is the best fix because it removes dependency on a deprecated internal-style API.
6. Use a temporary fallback only if you are blocked
If the warning is caused by an upstream package and no fix exists yet, you have two practical short-term options:
- Use an earlier Node version such as a stable Node 20 LTS in local development.
- Wait for the dependency maintainer to publish a compatible release.
With nvm:
nvm install 20
nvm use 20
This does not solve the root issue, but it can reduce friction until the package ecosystem catches up.
7. Verify that the warning is gone
Start the dev server again:
npm run dev
If needed, re-run with tracing:
NODE_OPTIONS="--trace-deprecation" npm run dev
No deprecation stack trace means the offending code path has been removed or upgraded successfully.
Common Edge Cases
The warning comes from Next.js internals, not your app
If the trace lands inside framework code, first upgrade Next.js to the latest version. Framework teams usually patch these issues quickly once new Node releases expose them.
The trace points to a dev-only package
Sometimes the warning comes from ESLint, a webpack plugin, a custom script runner, or a CLI utility. In that case, your production app may be fine, but your local toolchain still needs updates.
The package is unmaintained
If the dependency has not been updated in a long time, you may need to replace it entirely. Search its release notes, issue tracker, or repository homepage using a hyperlinked package reference rather than relying on old versions indefinitely.
You use a monorepo
In monorepos, the deprecated package may come from another workspace. Run dependency inspection commands from the workspace root and the specific app package to avoid missing duplicated versions.
The warning persists after upgrading
This usually means one of these is still true:
- Your lockfile still pins the old version.
- Another package depends on the same outdated library.
- Your package manager cache or build output is stale.
Delete node_modules, your lockfile if appropriate, and the .next build cache before reinstalling.
FAQ
Is this warning dangerous in production?
Usually no. A deprecation warning does not automatically break runtime behavior. It means future Node versions may remove the API entirely, so it should still be fixed before it becomes a hard failure.
Can I ignore util._extend deprecation warnings?
You can temporarily ignore them, but that is not recommended as a long-term solution. The better fix is to upgrade or replace the dependency that still uses the deprecated API.
Why did this start only after upgrading to Node 22.9.0?
Because the underlying deprecated usage likely already existed in your dependency tree, but Node 22.9.0 made that usage visible during startup. The upgrade exposed a compatibility problem rather than creating one from scratch.
Bottom line: this issue is almost always caused by an outdated dependency, not by Next.js itself. Trace the warning, upgrade the responsible package, use overrides for transitive dependencies, and fall back to Node 20 LTS only if you need a temporary development workaround.