Skip to content
Back to the playbook

Diagnosing ERR_MODULE_NOT_FOUND after upgrading Node

Node.jsrevision 1

Diagnostic tree

  1. In progressERR_MODULE_NOT_FOUND after upgrading NodeNode's mandatory-extension and package.json 'exports' rules under "type": "module" have been in place since ESM support landed, well before Node 20 or 22 — the version upgrade is usually the trigger only because it shipped with a dependency/lockfile update, not because Node's own resolution rules changed.
View the whole map (5 more steps)
  • Does the failing specifier point at your own file, or an installed package?
  • Fix: add the required file extension to the relative import
  • Check the dependency's package.json 'exports' field for the path being imported
  • Root cause: the dependency's exports map no longer allows this import path
  • The exports map isn't blocking this

What to test

ERR_MODULE_NOT_FOUND after upgrading Node

Node's mandatory-extension and package.json 'exports' rules under "type": "module" have been in place since ESM support landed, well before Node 20 or 22 — the version upgrade is usually the trigger only because it shipped with a dependency/lockfile update, not because Node's own resolution rules changed.

What happened?