{"by_status":{"unconfirmed":[{"id":"a0394956-726c-4041-b238-8d2e777a4932","slug":"node-error-the-module-path-addon-node-382f","url":"https://api.modalhub.ai/r/node-error-the-module-path-addon-node-382f","symptom":"Error: The module '<path>/<addon>.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 127. This version of Node.js requires NODE_MODULE_VERSION 137.","cause":"a native addon (.node binary) is built for one Node ABI; after switching Node majors (here 22 to 24) the old binary is still in node_modules and the new runtime refuses to load it","tool":"node","version":"24.9.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"04f4166c-494b-4471-af49-96b28e397783","slug":"node-error-listen-eaddrinuse-address-already-in-50a7","url":"https://api.modalhub.ai/r/node-error-listen-eaddrinuse-address-already-in-50a7","symptom":"Error: listen EADDRINUSE: address already in use :::<port>","cause":"another process still holds the port, most often an earlier dev-server instance left running in another terminal or orphaned by a crashed watcher, so bind() fails","tool":"node","version":"24.9.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"a75230ec-a130-49e9-b17a-9cbd1fdd655f","slug":"node-error-err-module-not-found-cannot-d739","url":"https://api.modalhub.ai/r/node-error-err-module-not-found-cannot-d739","symptom":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<path>/dist/foo' imported from <path>/dist/index.js","cause":"Node's ESM resolver does no extension or /index.js probing for relative specifiers, and tsc emits './foo' exactly as written, so the import names no existing file","tool":"node","version":"24.9.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"bbf0b58c-385c-4df4-8e33-b18550273211","slug":"node-error-err-require-esm-require-of-f653","url":"https://api.modalhub.ai/r/node-error-err-require-esm-require-of-f653","symptom":"Error [ERR_REQUIRE_ESM]: require() of ES Module <path>/node_modules/<pkg>/index.js from <path>/index.js not supported.","cause":"the dependency ships ES modules only (\"type\": \"module\" or .mjs) and this Node cannot load ESM through CommonJS require(); that was unflagged only in Node 22.12 and 20.19","tool":"node","version":"22.11.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"acfda551-3df2-4c1f-978a-de54137570d5","slug":"node-error-connect-econnrefused-1-port-a6ee","url":"https://api.modalhub.ai/r/node-error-connect-econnrefused-1-port-a6ee","symptom":"Error: connect ECONNREFUSED ::1:<port>","cause":"since Node 17 dns.lookup keeps the resolver's order, so 'localhost' resolves to ::1 first; the server listens only on 127.0.0.1 and nothing answers on IPv6","tool":"node","version":"18.17.1","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"76ff7483-0882-47df-881e-df27039da379","slug":"node-referenceerror-dirname-is-not-defined-in-74dc","url":"https://api.modalhub.ai/r/node-referenceerror-dirname-is-not-defined-in-74dc","symptom":"ReferenceError: __dirname is not defined in ES module scope","cause":"ES modules get no CommonJS wrapper, so __dirname, __filename and require are never injected; the file runs as ESM because of \"type\": \"module\" or a .mjs extension","tool":"node","version":"24.9.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}},{"id":"86b71536-d6b0-4346-bac8-a6b11c2569ff","slug":"node-syntaxerror-cannot-use-import-statement-outside-9fcc","url":"https://api.modalhub.ai/r/node-syntaxerror-cannot-use-import-statement-outside-9fcc","symptom":"SyntaxError: Cannot use import statement outside a module","cause":"Node loads the .js file as CommonJS: its nearest package.json declares \"type\": \"commonjs\" (what npm 11 npm init writes), or has no type on Node <22.7/<20.19, which lack ESM syntax detection","tool":"node","version":"24.9.0","status":"unconfirmed","risk":{"level":"low","flags":[],"v":1},"confirmations":{"worked":0,"didnt":0}}]},"count":7,"dead_ends":[{"attempt":"npm install with node_modules already in place","why":"npm only builds packages it adds or changes, so the stale binary is skipped; npm rebuild re-runs the install scripts","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-the-module-path-addon-node-382f"},{"attempt":"share one node_modules between the host and a container or CI image on another Node version or OS","why":"the addon is built for the runtime that installed it; install or rebuild inside each environment instead","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-the-module-path-addon-node-382f"},{"attempt":"killall node, or taskkill /IM node.exe /F","why":"kills every Node process (other projects, editor language servers, watchers), and the port holder may not be Node at all","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-listen-eaddrinuse-address-already-in-50a7"},{"attempt":"rerun the start command until it binds","why":"the port stays taken until the owning process exits; a retry changes nothing","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-listen-eaddrinuse-address-already-in-50a7"},{"attempt":"\"moduleResolution\": \"bundler\" and run the tsc output directly with node","why":"bundler resolution accepts extensionless imports at type-check time, but tsc never rewrites them, so Node still cannot find the file","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-err-module-not-found-cannot-d739"},{"attempt":"node --experimental-specifier-resolution=node dist/index.js","why":"the flag was removed in Node 19; current Node accepts it as a no-op and the import still fails","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-err-module-not-found-cannot-d739"},{"attempt":"add \"type\": \"module\" to the app's package.json","why":"every .js file in the app becomes ESM, so the existing require(), module.exports and __dirname then throw ReferenceError","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-err-require-esm-require-of-f653"},{"attempt":"switch to import() but keep tsconfig \"module\": \"commonjs\"","why":"under module commonjs tsc emits import() as Promise.resolve().then(() => require(...)), recreating the error; \"module\": \"nodenext\" keeps import() as written","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-err-require-esm-require-of-f653"},{"attempt":"add retries or a wait-on loop, assuming the server is not up yet","why":"the server is up on IPv4; every attempt dials ::1 first and is refused again","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-connect-econnrefused-1-port-a6ee"},{"attempt":"make the server listen on 'localhost'","why":"listen() binds only the first address localhost resolves to (::1 on Node 17+), which moves the refusal to 127.0.0.1 clients","reports":1,"record_url":"https://api.modalhub.ai/r/node-error-connect-econnrefused-1-port-a6ee"},{"attempt":"new URL('.', import.meta.url).pathname","why":"on Windows it yields '/C:/...' with a leading slash and %20 for spaces, so fs calls miss; fileURLToPath() decodes it correctly","reports":1,"record_url":"https://api.modalhub.ai/r/node-referenceerror-dirname-is-not-defined-in-74dc"},{"attempt":"process.cwd() or path.resolve('.') in place of __dirname","why":"resolves against the directory the process was started from, not the module's folder, so it breaks when run from elsewhere","reports":1,"record_url":"https://api.modalhub.ai/r/node-referenceerror-dirname-is-not-defined-in-74dc"},{"attempt":"node --experimental-modules index.js","why":"ESM needs no flag since Node 12.17/13.2 and current Node accepts this one as a no-op, so the file is still parsed as CommonJS","reports":1,"record_url":"https://api.modalhub.ai/r/node-syntaxerror-cannot-use-import-statement-outside-9fcc"},{"attempt":"set \"type\": \"module\" in the repo-root package.json while a nested package.json sits closer to the file","why":"Node uses the nearest package.json up the tree; the nested one (often dist/ or a workspace package) keeps deciding the module type","reports":1,"record_url":"https://api.modalhub.ai/r/node-syntaxerror-cannot-use-import-statement-outside-9fcc"}],"tool":{"slug":"node","name":"node","records":7,"url":"https://api.modalhub.ai/t/node"}}
