Error code

Node.js ERR_UNSUPPORTED_DIR_IMPORT

NODE.JSERR_UNSUPPORTED_DIR_IMPORT
Runtime Error Code· An error code from a programming runtime or package manager, like Node.js or npm.

What it means

A directory was imported directly but Node.js does not support directory imports in ESM.

How to fix it

  1. Import the specific file explicitly (e.g. ./utils/index.js).
  2. Add a package.json with a main field inside the directory when using CJS.

Not affiliated with Node.js. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.