JavaScript & Node.js Errors
npm resolution, async pitfalls, hydration, memory limits and runtime type errors.
Understanding JavaScript errors
JavaScript errors cluster into package management (resolution conflicts, lockfile drift, native build failures), asynchrony (unhandled rejections, race conditions, wrong this), and memory (the V8 heap limit, which is a fixed ceiling rather than a leak indicator on its own). Because JavaScript coerces rather than throws, many bugs surface far from their cause. undefined is not a function usually means a bad import, not a bad call.
How to debug JavaScript errors
- For dependency errors, read what npm actually reports as the conflicting peer requirement. Reaching for
--forceor--legacy-peer-depsinstalls a tree you have not validated. - Always attach a rejection handler:
process.on('unhandledRejection', …)in Node, and check that every async function called from a non-async context has a.catch(). - Raise the V8 heap only after confirming it is a genuine working-set problem:
node --max-old-space-size=4096. If usage grows without bound, take a heap snapshot instead. - Use
node --inspectwith Chrome DevTools to take heap snapshots and compare allocations between two points in time. - For native module build failures (node-gyp), confirm Python and a C++ toolchain are present and that the Node major version matches the module's prebuilt binaries.
Tools worth reaching for
node --inspectnpm ls <pkg>node --max-old-space-sizeclinic.jswhy-is-node-running
All 42 JavaScript errors
- bun install: lockfile had changes, but lockfile is frozen NewCI runs bun install --frozen-lockfile so a build can never silently resolve different versions. The error means…
- Bun: Cannot find moduleBun could not resolve an import: dependencies not installed, a path/extension typo, or a package relying on Node APIs…
- Deno: PermissionDenied: Requires net/read accessDeno is secure by default and blocks file, network, and env access unless explicitly granted with --allow flags.
- ESLint: could not find an eslint.config.js file NewESLint v9 reads flat config (eslint.config.js) by default and no longer looks for .eslintrc.*. An existing project…
- JavaScript: 'this' is undefined in callbackContext lost when passing method as callback. Need to bind context or use arrow function.
- JavaScript: Closure capturing wrong loop variableLoop variable captured by closure refers to final value, not value at time of creation.
- JavaScript: CORS credentials not allowedCannot use credentials with wildcard origin. CORS policy requires specific origin when using credentials.
- JavaScript: Memory leak from event listenersEvent listeners not removed when elements destroyed, causing memory leaks.
- JavaScript: Race condition in async operationsMultiple async operations completing in unexpected order causing data inconsistency.
- JavaScript: Unhandled promise rejectionPromise rejected but no .catch() handler or try/catch block present.
- Next.js 15: `params` should be awaited before using its properties NewNext.js 15 made params, searchParams, cookies() and headers() asynchronous so a page can start rendering before…
- Next.js: Dynamic server usage (route couldn't be rendered statically) NewA route Next.js wanted to prerender at build time used a request-scoped API such as cookies(), headers() or…
- Next.js: Hydration failed because the initial UI does not matchServer-rendered HTML differs from client render. Causes include non-deterministic renders, browser-only APIs on…
- Next.js: You're importing a component that needs useState in a Server Component NewIn the App Router every component is a Server Component by default. Hooks, event handlers and browser APIs only exist…
- Node.js: DeprecationWarning: The `punycode` module is deprecated NewSomething in the dependency tree still requires Node's built in punycode. Your own code almost never does: it comes…
- Node.js: ERR_MODULE_NOT_FOUND (missing file extension) NewES module resolution in Node does not guess extensions the way CommonJS did. An import of './utils' fails even when…
- Node.js: ERR_REQUIRE_ESM NewCommonJS code used require() on a package that ships only ES modules. Node 22+ can require() synchronous ESM graphs…
- Node.js: ERR_UNSUPPORTED_DIR_IMPORT NewAn ESM import pointed at a directory. Unlike CommonJS, ESM does not resolve a directory to its index.js. You must…
- Node.js: error:0308010C:digital envelope routines::unsupported NewNode 17+ links OpenSSL 3, which refuses the legacy MD4 hash that older Webpack 4 builds use for chunk names. The build…
- Node.js: MaxListenersExceededWarning: possible EventEmitter memory leak NewMore than ten listeners were added to the same event on one emitter. The default is a leak detector, not a limit: it…
- Node.js: node-gyp build failedNative module compilation failed. Missing build tools or incompatible Node version.
- Node.js: TypeError: fetch failed NewNode's built in fetch throws a deliberately vague TypeError and hides the real reason in the cause property…
- npm ci: package.json and package-lock.json are not in sync Newnpm ci refuses to install when the lockfile does not match package.json. This is deliberate: CI must install exactly…
- npm ERR! code E401 on a private registry Newnpm reached the registry but sent no usable credentials for that scope. The common causes are an .npmrc that…
- npm ERR! code ELIFECYCLEA script referenced in package.json failed to execute (exit code != 0). The error is in the script itself, not npm.
- npm ERR! ERESOLVE unable to resolve dependency treenpm 7+ enforces peer dependency constraints. One package requires a peer version that conflicts with another dependency.
- npm error code EJSONPARSE Newnpm could not parse package.json or package-lock.json. Nearly always a trailing comma, a comment, a smart quote pasted…
- npm: EBADENGINE Unsupported engine NewA package declares an "engines" range that your Node or npm version does not satisfy. npm warns by default and fails…
- npm: Network socket timeoutnpm registry request timed out. Slow network, firewall blocking, or npm registry issues.
- pnpm: ERR_PNPM_OUTDATED_LOCKFILEpnpm-lock.yaml is out of sync with package.json and CI is running with --frozen-lockfile.
- RangeError: Maximum call stack size exceededJavaScript hit its call stack limit, usually from infinite recursion, circular getters, or trying to stringify a…
- React: Cannot update a component while rendering a different component NewA setState call from one component ran during another component's render, usually a state update written directly in…
- React: Each child in a list should have a unique "key" prop NewReact uses keys to match elements between renders. Without them, or with the array index as the key, reordering or…
- React: Hydration failed because the initial UI does not matchThe HTML rendered on the server (SSR) doesn't match what React rendered on the client. Common causes: invalid HTML…
- React: Rendered more hooks than during the previous render NewA hook ran on this render that did not run on the last one, which happens when a hook sits after an early return or…
- React: Too many re-rendersState is updated unconditionally during render, or an effect dependency changes every render and triggers an infinite…
- ReferenceError: window is not defined NewThe module ran on the server, where there is no DOM. Next.js, Nuxt, SvelteKit and Remix all execute components and…
- Tailwind CSS class does not appear in built CSSTailwind only generates class names it can see as literal strings. Dynamically constructed names can be purged from…
- TypeError: Cannot read properties of undefined (reading 'X')Code accessed a property on undefined, commonly because API data has not loaded yet or the response shape changed.
- TypeScript: Type 'null' is not assignable to type 'string'Strict null checks are enabled. You are trying to pass null/undefined to a variable expected to be a string.
- Vite: JavaScript heap out of memory during buildThe Node build process exceeded the default heap limit, often because of large source maps, many modules, or oversized…
- Yarn PnP: a package tried to access an undeclared dependency NewPlug'n'Play enforces the dependency graph strictly: a package may only require what it declares. Code that relied on a…
Other categories
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Ansible 10Unreachable hosts, become passwords, undefined variables and Jinja2 failures.
- API 14Auth headers, payload limits, versioning, idempotency and webhook signatures.
- Apple 10Command line tools, dyld, Homebrew permissions, notarisation and Keychain.
- Auth 11OIDC, SAML, Auth0, Okta, Keycloak, passkeys and MFA failures.
- BigData 11Spark, Kafka, Airflow, Snowflake, Flink and Databricks failures.
- C# 12NuGet restore, null references, EF Core migrations, async deadlocks and Blazor…
- C++ 11Segfaults, linker errors, memory corruption and template deduction failures.
- Caching 10Cache stampedes, stale content, Varnish and CloudFront failures.
- CI/CD 18GitHub Actions, GitLab CI, Jenkins, CircleCI: permissions, runners and…
- Client 21CORS, mixed content, module resolution, memory limits and framework runtime…
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Dart 10Null safety, pub version solving and build toolchain problems.
- Database 41Connections, deadlocks, constraints, replication and memory limits.
- DNS 10NXDOMAIN, SERVFAIL, timeouts, propagation and delegation problems.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- Elixir 9GenServer timeouts, supervision failures and Mix compilation problems.
- Email 8Delivery failures, relay denial, authentication, SPF, DKIM and DMARC.
- Frontend 23Hydration mismatches, bundler resolution, layout shift and font loading.
- Git 20Merge conflicts, rejected pushes, detached HEAD, LFS and repository corruption.
- Go 19Nil map assignment, concurrent map access, context cancellation and deadlocks.
- GraphQL 13Validation, depth limits, N+1 queries and fragment problems.
- gRPC 10Status codes, deadlines, message limits, TLS and HTTP/2 transport failures.
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- ICMP 23Destination unreachable, time exceeded, fragmentation needed and redirects.
- Ingress 8404 default backend, missing TLS secrets, IngressClass and path matching.
- Java 19Class loading, dependency resolution, connection pools and JVM version…
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Logging 9Log4j, Logback, Fluentd, Logstash and CloudWatch ingestion problems.
- MessageQueue 14Kafka, RabbitMQ, SQS, NATS and Celery: lag, rebalancing and poison messages.
- Mobile 17Gradle, CocoaPods, Xcode signing, Metro bundler and toolchain mismatches.
- Monitoring 12Prometheus scrapes, Grafana data sources, OpenTelemetry exporters and agent…
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Performance 6GC pauses, thread pool starvation and event loop blocking.
- PHP 11Memory limits, execution timeouts, autoloading, Composer and PDO connections.
- Proxy 17nginx, Envoy, HAProxy, Traefik, Caddy and Cloudflare upstream failures.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Regex 8Catastrophic backtracking, back references, escaping and engine differences.
- Ruby 11Bundler, migrations, native extensions, encoding and asset compilation.
- Rust 19Borrow checker, ownership moves, trait bounds and lifetime mismatches.
- Scala 6Dependency resolution, binary compatibility and type inference failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- Serverless 11Lambda timeouts, package size limits, VPC networking and cold starts.
- Shell 13Command not found, permissions, quoting, expansion and Makefile syntax.
- Storage 13S3 permissions, NFS mounts, quotas, signed URLs and volume attachment.
- Svelte 10Store subscriptions, load functions and server/client boundaries.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Terraform 18State locks, provider auth, drift, dependency cycles and plan-time unknowns.
- Testing 18Jest, pytest, JUnit, Cypress and Playwright: fixtures, snapshots and timeouts.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
- TypeScript 19Assignability, missing declarations, strict null checks and generic constraints.
- Virtualization 8VirtualBox, VMware, Hyper-V, WSL, KVM and hypervisor conflicts.
- Web3 7Gas estimation, nonce management and reverted transactions.
- WebAssembly 7Compile errors, memory bounds and host binding mismatches.
- WebServer 10nginx, Apache, IIS and Caddy: binding, permissions, rewrites and TLS.
- Windows 10Installer failures, missing runtimes, update errors and permission problems.