🟩 Node.js errors

Node.js runtime errors: module resolution, ports in use, file system and network errno codes.

CodeErrorWhat it means
req.body undefined Express: req.body is undefined / {} (body parser missing) Express didn’t parse the request body because no body-parsing middleware matched the request’s Content-Type.
nodemon crashed [nodemon] app crashed - waiting for file changes before starting... Your app threw an error on startup; nodemon is waiting for a file change to retry.
CastError ObjectId CastError: Cast to ObjectId failed for value "x" (type string) at path "_id" A value that isn’t a valid 24-hex-character ObjectId was used in an _id query.
DEP0005 DeprecationWarning: Buffer() is deprecated due to security and usability issues (DEP0005) Code (yours or a dependency) uses the deprecated new Buffer() constructor.
DEP0040 DeprecationWarning: The `punycode` module is deprecated (DEP0040) A dependency imports Node’s built-in punycode module, deprecated since Node 21.
ERR_HTTP_HEADERS_SENT Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client An Express/Node handler tried to send a second response (or set headers) after one was already sent.
ERR_PACKAGE_PATH_NOT_EXPORTED Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './x' is not defined by "exports" You imported a deep path inside a package that its package.json "exports" field doesn’t expose.
ERR_REQUIRE_ESM Error [ERR_REQUIRE_ESM]: require() of ES Module not supported CommonJS code used `require()` on a package that is ES-module-only (node-fetch 3, chalk 5, nanoid 4, got 12…).
ERR_STREAM_PREMATURE_CLOSE Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close A stream ended or was destroyed before it finished — often a client disconnect or upstream aborting a downloa…
ERR_TLS_CERT_ALTNAME_INVALID Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames The server’s certificate doesn’t cover the hostname you connected to.
prisma generate Error: @prisma/client did not initialize yet. Please run "prisma generate" The generated Prisma Client is missing or out of date.
MODULE_NOT_FOUND Error: Cannot find module 'x' (MODULE_NOT_FOUND) Node can’t resolve the module path — the package isn’t installed, or a relative path/extension is wrong.
ECONNREFUSED Error: connect ECONNREFUSED 127.0.0.1:5432 Nothing is listening at that host:port — the target service is down or you’re connecting to the wrong address.
EEXIST Error: EEXIST: file already exists, mkdir Node tried to create a file/directory/symlink that already exists.
EISDIR Error: EISDIR: illegal operation on a directory, read A file API (readFile, writeFile, createReadStream) was given a directory path.
ENOENT Error: ENOENT: no such file or directory A file or directory the program tried to open doesn’t exist at that path.
ENOTDIR Error: ENOTDIR: not a directory A path treats a file as if it were a directory (e.g. file.txt/child).
EPERM Error: EPERM: operation not permitted, rename / unlink The OS refused a file operation — on Windows usually because another process (antivirus, editor, indexer) has…
ERR_OSSL_EVP_UNSUPPORTED Error: error:0308010C:digital envelope routines::unsupported An old build tool (webpack 4, old react-scripts) uses a hash algorithm that OpenSSL 3 in Node 17+ disables.
listen EACCES Error: listen EACCES: permission denied 0.0.0.0:80 Node isn’t allowed to bind that port — ports below 1024 need root on Linux/macOS, and some Windows ports are…
EADDRINUSE Error: listen EADDRINUSE: address already in use :::3000 Another process is already listening on that port.
node-sass Error: Node Sass does not yet support your current environment node-sass (deprecated) has no binary for your Node version/OS.
Prisma P1001 Error: P1001: Can't reach database server at `host`:`5432` Prisma couldn’t connect to the database in DATABASE_URL.
spawn EACCES Error: spawn EACCES Node tried to execute a file that isn’t executable (missing +x permission) or isn’t a program.
Unhandled 'error' event Error: Unhandled 'error' event (events.js / node:events) An EventEmitter (stream, socket, child process, server) emitted 'error' and nothing listened for it, so Node…
EPIPE Error: write EPIPE Node wrote to a pipe or socket whose other end was already closed.
heap out of memory FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory The V8 heap hit its limit — a large build (webpack, tsc, Next.js) needs more memory, or the app leaks.
MaxListenersExceededWarning MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 listeners added More than 10 listeners were added to one event — often a leak where listeners are added repeatedly.
buffering timed out MongooseError: Operation `users.find()` buffering timed out after 10000ms Mongoose queued a query waiting for a connection that never opened.
MongoServerSelectionError MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 The MongoDB driver couldn’t find a reachable server for the connection string.
E11000 duplicate key MongoServerError: E11000 duplicate key error collection: db.users index: email_1 dup key An insert/update violated a unique index in MongoDB.
UnhandledPromiseRejection Node.js: [UnhandledPromiseRejection] — This error originated either by throwing inside of an async function without a catch block A promise rejected and nothing handled it; since Node 15 this crashes the process.
EBADENGINE npm WARN EBADENGINE Unsupported engine / The engine "node" is incompatible with this module A package requires a different Node.js version than the one you’re running.
Prisma P2002 PrismaClientKnownRequestError P2002: Unique constraint failed on the fields: (`email`) A Prisma create/update violated a unique constraint.
maxBuffer exceeded RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded child_process.exec/execSync produced more output than its buffer allows (default 1 MB).
NOAUTH ReplyError: NOAUTH Authentication required. The Redis server requires a password (or ACL user) but the client didn’t authenticate.
SequelizeConnectionRefusedError SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432 Sequelize couldn’t connect to the database server.
SyntaxError import SyntaxError: Cannot use import statement outside a module An `import` statement ran in a context treated as CommonJS (Node without "type": "module", a browser script w…
TS2532 / TS18048 TS18048: 'x' is possibly 'undefined'. (TS2532: Object is possibly 'undefined'.) TypeScript requires you to handle the case where a value may be undefined before using it.
TS2304 TS2304: Cannot find name 'x'. TypeScript doesn’t know an identifier — a missing import, missing type definitions (e.g. for Node or Jest glo…
TS2307 TS2307: Cannot find module 'x' or its corresponding type declarations. TypeScript can’t resolve the import — the package isn’t installed, the path alias isn’t configured, or there…
TS2339 TS2339: Property 'x' does not exist on type 'Y'. TypeScript’s type for the object doesn’t include that property.
TS2345 TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. A value’s type doesn’t match the function parameter — commonly a possibly-undefined value passed where a defi…
TS7016 TS7016: Could not find a declaration file for module 'x'. 'x.js' implicitly has an 'any' type. The JavaScript package has no TypeScript types bundled and no @types package installed.
ERR_IMPORT_ATTRIBUTE_MISSING TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module needs an import attribute of "type: json" An ES module imported a .json file without the required import attribute.
ERR_INVALID_ARG_TYPE TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined A Node API got an argument of the wrong type — usually undefined because an env var or config value is missin…
ERR_UNKNOWN_FILE_EXTENSION TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" Node tried to run a TypeScript file as ESM without a TypeScript loader.
fetch failed TypeError: fetch failed (cause: ConnectTimeoutError / ECONNREFUSED / UND_ERR) Node’s built-in fetch (undici) couldn’t complete the request; the real reason is in error.cause.
path-to-regexp TypeError: Missing parameter name at 1 (path-to-regexp) An Express 5 (path-to-regexp v8) route uses old wildcard syntax like '*' or '/:id?'.
Router.use middleware TypeError: Router.use() requires a middleware function but got a Object app.use()/router.use() received an object instead of a function — usually a router module that wasn’t exporte…
Mongoose ValidationError ValidationError: User validation failed: email: Path `email` is required. A document failed Mongoose schema validation before saving.
WRONGTYPE WRONGTYPE Operation against a key holding the wrong kind of value A Redis command was used on a key of a different type (e.g. HGET on a string key).