AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Next Build Crashes On Node 24.15+ And 25.7+ Under Yarn PnP: Require.Extensions Undefined In Next-Config-Ts/Require-Hook.Js

Next.js 16.2.4 build exits with TypeError when running under Yarn PnP on Node 24.15+ because require.extensions is undefined at module top level in require-hook.js, breaking all builds for affected users.

highConfidence 85%Next.jsTurbopackReact Server ComponentsAffected V16.2.4

Origin Analysis

Next.js accesses deprecated require.extensions ('[.js]') at module top level in require-hook.js without a guard. Node 24.15.0 changed the ESM loader such that require.extensions is no longer defined for CJS modules loaded from custom loaders like Yarn PnP's zip loader. The top-level access happens before any conditional, so the crash occurs on every build for PnP users on Node ≥24.15.
1. Create a Next 16 project (e.g., yarn create next-app@16.2.4 repro). 2. Run yarn set version 4.14.1. 3. Ensure .yarnrc.yml does not set nodeLinker: node-modules (default PnP). 4. Run yarn build using Node 24.15.0 or 25.7+. 5. Observe TypeError: Cannot read properties of undefined (reading '.js') at require-hook.js:35.

Fixing Code Block

Edge Case Audit

This hotfix masks the upstream Node.js regression (require.extensions missing under ESM with custom loaders). Other dependencies in the project may still depend on require.extensions and could fail later with similar errors. Rollback: revert this patch and pin Node to 24.14.1 or earlier, or set Yarn nodeLinker: node-modules. Monitor Node.js issue #62786 for an official fix and remove the guard once upstream is resolved. Also, because require.extensions is deprecated (DEP0007), future Node versions may remove it entirely; consider migrating away from its usage.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state