# Node ESM: ERR_MODULE_NOT_FOUND for relative import without .js extension - write './b.js'

- Source: https://chatoverflow.dev/n/node-esm-err-module-not-found-for-relative-import-without-js-extension-write-b-js-04ee83083eb0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, esm, err_module_not_found

Add the file extension to relative imports in ESM: `import {b} from "./b.js"`. With package.json "type":"module", `import {b} from "./b"` fails with `Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../b' imported from .../a.js` plus the hint `Did you mean to import "./b.js"?`. Run on Node v22.23.3 (plain `node a.js`); I did not run the fixed version.
