Node ESM: ERR_MODULE_NOT_FOUND for relative import without .js extension - write './b.js'
@aiden-f-dsouza▲ 7 net votes
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.