Home · Topic · 69 entries
Common Node.js errors, fixed and tested on Node 24
Node keeps changing how modules load, which ports it binds and which crypto it allows, so a fix written for Node 16 can be wrong on Node 24. Each entry below was reproduced on current Node, with the exact version written at the top of the post.
Entries
- No.117
SASL: "client password must be a string" (node-postgres)
node-postgres throws this before Postgres checks the password: the password it got is not a string. Eight ways to cause it, tested with pg 8.23.1, and the fix.
> Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
DATABASE2 min - No.113
Fix: TS18046 'error' is of type 'unknown' in a catch block
Why TS18046 appeared after upgrading to TypeScript 6 or 7 with no config change, tested on 5.9.3 to 7.1 beta, and which fixes pass: instanceof, a helper, any.
> a.ts(1,53): error TS18046: 'error' is of type 'unknown'.
FIXED3 min - No.112
pnpm 12 breaking changes, tested: the errors pnpm 11 didn't give
Four commands that exited 0 on pnpm 11.28.13 failed on 12.21.0: a misspelled setting in a pinned project (ERR_PNPM_UNRECOGNIZED_WORKSPACE_SETTINGS), --frozen-lockfile false, --resolution-only, and sudo pnpm add -g (ERR_PNPM_SUDO_NOT_SUPPORTED). pnpm add yarn now changes packageManager instead of adding a dependency. Each of the four errors has a one-line fix; for the yarn change, pnpm documents a one-line specifier (`pnpm add yarn@npm:yarn@1.22.22`) that was not run.
TESTED4 min - No.111
Codex MCP startup incomplete: what each failure prints
Codex 0.171.0 hides MCP startup errors behind a warnings count. Tested: a crash, a missing key, a bad command, an npx 404, a slow server, and the fix for each.
> ⚠ 2 warnings · f2 to view
AGENTS4 min - No.110
Cannot find module @rollup/rollup-linux-x64-gnu: what causes it
Rollup blames an npm bug and says to delete your lockfile. On npm 11 that wasn't it: five setups that gave the error on Linux and Alpine, and the fix for each.
> Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
FIXED3 min - No.109
Better Auth: Invalid origin, default secret and base URL errors
Better Auth's Invalid origin, MISSING_OR_NULL_ORIGIN, default secret and base URL errors: 24 setups on 1.7.27 and the status, code and log line each one gave.
> 403 {"message":"Invalid origin","code":"INVALID_ORIGIN"}
FIXED4 min - No.108
sh: vite: command not found on Linux, macOS, CI and Docker
sh: vite: command not found in CI, Docker or a Linux shell: six causes tested on Ubuntu and macOS, the exact message each one prints, and which fix worked.
> > vite build
FIXED4 min - No.107
Stripe: No signatures found matching the expected signature
Stripe webhook signature errors in Express, Next.js, Hono, Fastify and Workers: which mistake gives which of four messages, and the body that verifies. 30 runs.
> StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
FIXED5 min - No.105
ERR_PNPM_IGNORED_BUILDS: onlyBuiltDependencies no longer works
pnpm 11 and 12 fail installs with ERR_PNPM_IGNORED_BUILDS and ignore onlyBuiltDependencies. pnpm 10, 11 and 12 tested: the allowBuilds setting that passes.
> Error: ERR_PNPM_IGNORED_BUILDS
FIXED4 min - No.103
Fix: npm error code EALLOWGIT, tested
npm error code EALLOWGIT: npm 12 blocks git dependencies by default. The setting that allows them, which values work, every git case tested on npm 12 and 11.
> npm error code EALLOWGIT
FIXED6 min - No.100
Fix: Puppeteer "Failed to launch the browser process" (Code: 127)
Chrome downloads, then Puppeteer exits with Code: 127 on slim Debian. The missing libraries, apt packages for Debian 12 and 13, and the launch that worked.
> Error: Failed to launch the browser process: Code: 127
FIXED2 min - No.099
jsdom 31: getContext needs @napi-rs/canvas, and load moved
jsdom 31 returns null from getContext with canvas installed: it now loads @napi-rs/canvas. And load no longer fires on document. Both tested.
> Not implemented: HTMLCanvasElement's getContext() method: without installing the @napi-rs/canvas npm package
FIXED3 min - No.096
Gemini "model is not found for API version v1beta": the fix
Gemini 404: model not found for API version v1beta or v1. I called 13 names on both: which don't exist, why v1 never helps, and the SDK 3.0 trap.
> models/gemini-3-flash is not found for API version v1beta, or is not supported for generateContent. Call ModelService.ListModels to see the list of available models and their supported methods.
AI5 min - No.093
Fix: bigint Failed to load bindings, pure JS will be used
bigint: Failed to load bindings, pure JS will be used. Why npm 12 shows it on every install, whether it matters, and how to get the native build back.
> bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
FIXED3 minWindows - No.092
TypeScript 7.1 beta tested: ts-jest, ESLint, NestJS, Angular
On TypeScript 7.1.0-beta, ts-jest, typescript-eslint, ts-node and TypeDoc failed exactly as on 7.0, and so did NestJS, Angular, vue-tsc, svelte-check and astro check. The beta does ship a compiler API, but at new entry points (typescript/sync and typescript/async) that no tool uses yet. The side-by-side setup with TypeScript 6 fixed every one I re-ran.
TESTED4 min - No.091
Fix: npm error code EALLOWREMOTE (and EALLOWGIT), tested
npm error code EALLOWREMOTE on npm 12: why remote dependencies stopped installing, and the one setting that brings them back. Every case tested, npx to npm ci.
> npm error code EALLOWREMOTE
FIXED4 min - No.090
Node 26 error: libatomic.so.1 cannot open shared object file
node: error while loading shared libraries: libatomic.so.1 after moving to Node 26? Tested on 9 Linux images, Docker and nvm: what each distro is missing.
> node: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory
FIXED4 min - No.088
Responses.create() unexpected keyword argument: new names
max_tokens, messages, response_format, seed: their names in OpenAI's Responses API, tested. Plus the 'proxies' TypeError from httpx 0.28.
> TypeError: Responses.create() got an unexpected keyword argument 'max_tokens'
AI6 min - No.087
Claude SDK: unexpected keyword argument temperature, betas
Messages.create() got an unexpected keyword argument after an anthropic upgrade, plus what SDK 2.0 (October 21) breaks next. Python and TypeScript, tested.
> TypeError: Messages.create() got an unexpected keyword argument 'temperature'
AI5 min - No.086
npm error code EACCES: permission denied, 3 causes tested
npm error code EACCES with syscall mkdir or open: a global install, a cache that sudo left behind, or Docker. Each reproduced, with the fix that lasts.
> npm error code EACCES
FIXED4 min - No.085
npm warn EBADENGINE Unsupported engine, tested
EBADENGINE is only a warning, until it isn't. Tested with Vite and React Router on Node 20 and 22: when npm warns, when it fails, and when it says nothing.
> npm warn EBADENGINE Unsupported engine {
FIXED4 min - No.084
npm error Invalid Version: lockfile or package.json?
"Invalid Version: 7.0" (capital V) comes from package-lock.json and breaks npm ci; "Invalid version: patch" is your own version field. Tested on npm 11, 12.
> npm error Invalid Version: 7.0
FIXED3 min - No.080
Fix: No 'Access-Control-Allow-Origin' header is present
Blocked by CORS policy, but Postman and curl work fine. Five versions of the error reproduced in Chrome with Express and Vite, and which fix fits each.
> Access to fetch at 'http://localhost:3001/plain/data' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
FIXED3 min - No.077
ReferenceError: process is not defined in Vite (dev vs build)
In Vite 8, process.env.X crashes in dev but is silently undefined in the build; NODE_ENV works in both. Tested in Chromium: import.meta.env, define, polyfills.
> Uncaught ReferenceError: process is not defined
FIXED5 min - No.076
The punycode module is deprecated (DEP0040): who causes it
Node 22+ prints DEP0040 for your code and bundles, not node_modules. Of 38 popular packages, only 4 still cause it (cross-fetch, web3...). Fix tested.
> (node:24108) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
FIXED5 min - No.072
npm error code ENOENT, and spawn npx ENOENT on Windows
Read the path line first. On Windows, spawn npx ENOENT has a twist: adding .cmd now fails with EINVAL. Four ENOENT causes reproduced, each with its fix.
> npm error code ENOENT
FIXED3 minWindows - No.071
Fix: JavaScript heap out of memory (Node.js, tested)
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory. Default limits measured, and two ways the usual fix silently fails.
> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
FIXED3 minWindows - No.070
No module named 'distutils' (Python 3.12+): 3 fixes, tested
Python 3.12 removed distutils. setuptools brings it back for Python code; npm installs need a newer npm (node-gyp 10+); msvccompiler needs setuptools below 74.
> ModuleNotFoundError: No module named 'distutils'
FIXED4 min - No.069
Fix: EBUSY: resource busy or locked (npm, Windows)
npm install and Node fail on Windows with EBUSY: resource busy or locked, rmdir. Reproduced: what holds the folder, how to find it, and why retrying fails.
> npm error code EBUSY
FIXED3 minWindows - No.068
Fix: self-signed certificate in certificate chain (npm)
npm install and fetch() fail with SELF_SIGNED_CERT_IN_CHAIN behind a company proxy. Reproduced on Windows and Linux: which fixes work, and two that don't.
> npm error code SELF_SIGNED_CERT_IN_CHAIN
FIXED3 minWindows - No.066
Deno Deploy shutdown: move to Workers or Node, tested
Deno Deploy closes in about six months. I moved a typical Deno Deploy app to Cloudflare Workers and to Node 26: every error, and what fixed each.
> Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'jsr:'
DEPLOY3 min - No.062
npm ci EUSAGE: lock file not in sync (6 causes, tested)
npm ci says package.json and package-lock.json aren't in sync. Six causes reproduced on npm 11 and 12, and the line in the error that tells them apart.
> npm error code EUSAGE
FIXED4 min - No.061
npm error code ETARGET: No matching version found (5 causes)
npm error code ETARGET: No matching version found, sometimes with a date before. Five causes reproduced on Windows 11 with npm 11 and 12, last re-run on 12.2.2.
> npm error code ETARGET
FIXED6 min - No.060
Claude "temperature is deprecated for this model" (400)
Switching to Claude Sonnet 5.5, Haiku 5.5 or Opus 4.7 breaks code that sets temperature, even temperature: 0. Every case tested, in Node and Python.
> BadRequestError: 400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` is deprecated for this model."}}
AI4 min - No.059
OpenAI Oct 23 model shutdown: the 404, list, replacements
gpt-3.5-turbo, gpt-4, o1, o3-mini and more stopped working on October 23, 2026. The real error, tested after the shutdown, and a check that misleads.
> NotFoundError: 404 The model `gpt-3.5-turbo` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations
AI4 min - No.057
Node 26 vs Node 24: what breaks when you upgrade, tested
Most projects move over cleanly: jsonwebtoken, bcrypt, sharp, better-sqlite3 13, tsx and Vitest all worked unchanged. What broke: Corepack and Yarn are gone (Docker builds fail with exit code 127), native modules installed under Node 24 refuse to load, fs.rmdir with recursive now throws (prisma generate with zod-prisma-types fails on the second run), and fs.W_OK disappeared without an error.
TESTED8 minWindows - No.056
ESLint "couldn't find an eslint.config.* file" (ESLint 10)
ESLint 10 dropped .eslintrc for good, and the old escape hatch is gone. Reproduced on 10.12.0, plus the React and Next.js plugin errors that follow.
> Oops! Something went wrong! :(
FIXED4 min - No.055
18 framework starters tested on Windows: what breaks
15 of 18 starters work on Windows 11: 14 with no issues at all, 1 with a workaround. Every Remix 3 script still fails out of the box and works on Linux; Docusaurus's Windows build failure is fixed by SWC 1.16.21, Nuxt's Windows-only 500 is fixed in 4.6.1, and React Router's installer in 8.5.1. Three more break in ways that tutorials and CI scripts hit: Angular needs a newer Node 24, Electron Forge renamed its template, and Cloudflare's C3 can exit successfully with a broken project.
TESTED8 minWindows - No.054
Drizzle "Failed query" error: find the real cause
Drizzle shows the SQL and params but not why it failed. Five causes reproduced, why e.code stopped working in 0.44, and the migration version.
> DrizzleQueryError: Failed query: insert into "users" ("id", "email", "name") values (default, $1, $2)
DATABASE4 min - No.049
"No longer available to new users": Gemini 2.5 Flash fix
New Gemini API keys get a 404 on 2.5 Flash and Pro. Which model names answer instead, tested, and why December 1 quietly moves old keys to Flash-Lite.
> {
AI5 min - No.048
Gemini API 429 RESOURCE_EXHAUSTED: why your limit is 0
Gemini's 429 hides three different limits, and one of them never resets. Each hit on purpose with a free key, plus the 503 high demand error.
> {
AI5 min - No.047
Fix: @prisma/client did not initialize yet (Prisma 6 and 7)
The error says run prisma generate. Why it keeps coming back on Windows, npm 12 and CI, reproduced, plus the errors Prisma 7 throws instead.
> D:\project\node_modules\.prisma\client\default.js:43
DATABASE5 minWindows - No.046
prisma generate not working: "No command registered" (Prisma 8)
npm now installs a Prisma 8 release candidate as prisma@latest. It has no generate, migrate dev or db push. Reproduced, with the fix for Docker and CI.
> {"kind":"result","envelope":{"ok":false,"commandId":"","error":{"code":"CLI.UNKNOWN_COMMAND","severity":"error","summary":"No command registered for `generate`","nextActions":[{"kind":"run-command","label":"List every command","command":"prisma --help"}]}}}
DATABASE7 min - No.044
Groq: llama-3.3-70b-versatile does not exist, 413 and 429
Groq says llama-3.3-70b-versatile does not exist? It isn't a typo or your key. What happened to the model, plus the look-alike 413 and 429 errors, tested.
> 413 Request too large for model `openai/gpt-oss-20b` in organization `org_…` service tier `on_demand` on tokens per minute (TPM): Limit 8000, Requested 30074, please reduce your message size and try again.
AI4 min - No.043
Fix: APIConnectionError "Connection error." (OpenAI, Anthropic)
OpenAI's and Anthropic's SDKs both say only Connection error. Five real causes reproduced, from a local model that isn't running to antivirus HTTPS scanning.
> APIConnectionError: Connection error.
AI5 minWindows - No.041
Vitest 4 to 5 migration: 6 breaking changes, tested
Six behaviours that passed on Vitest 4.1.11 failed or changed on 5.0.3, each with a clear message and a one-line fix. The sneaky one is test.each titles: snapshot keys change, and locally Vitest 5 quietly writes new snapshots instead of failing.
TESTED5 min - No.040
Fix: "Could not locate the bindings file" in sqlite3
sqlite3 or better-sqlite3 installed fine, then can't find its .node file. Four causes reproduced, how the Tried: paths tell them apart, and the fix for each.
> Error: Could not locate the bindings file. Tried:
FIXED3 min - No.037
npm 12 breaking changes, tested: what actually breaks
The headline change, install scripts blocked by default, broke puppeteer, cypress, sqlite3 and Claude Code's npm package, and silently skipped lefthook's git hooks. esbuild, bcrypt, sharp and better-sqlite3 kept working. Every install reported success, and the only sign was a warning after the summary.
TESTED6 minWindows - No.034
Fix: npm error Missing script: "dev" (and "start")
npm can't find the script you asked for. Six real causes, from a stray package.json up the tree to monorepos, and two commands that show which one you have.
> npm error Missing script: "dev"
FIXED6 min - No.030
Fix: MCP error -32000 Connection closed / Failed to connect
An MCP server fails with Connection closed or Failed to connect and never says why. Where the real error is hiding, and the fixes, tested in Claude Code.
> MCP error -32000: Connection closed
AGENTS4 min - No.029
TypeScript 7 migration guide: breaking changes, tested
Every option TypeScript 6.0.3 marked as deprecated was a hard error on 7.0.2, and ignoreDeprecations no longer silences it. Two defaults that arrived in 6.0 (strict on, @types not loaded automatically) also break projects coming straight from 5.9.
TESTED7 min - No.026
Fix: Dynamic require of "react" / "fs" is not supported
esbuild's ES module output throws this for a require() it left in the bundle. Four fixes tested on Node 24, plus the case only Cloudflare Workers hits.
> throw Error('Dynamic require of "' + x + '" is not supported');
FIXED3 min - No.023
Fix: TypeScript enum is not supported in strip-only mode
Node's ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX for enum, parameter properties, namespace, export = and import =. Two ways to run it unchanged, both tested.
> enum Color { Red, Green }
FIXED4 min - No.022
Fix: Could not resolve authentication method (Anthropic / Claude SDK)
Anthropic's SDK can't find your key. The old and new wording, ANTHROPIC_API_KEY vs ANTHROPIC_AUTH_TOKEN, and the 401 you get when a key is in the wrong one.
> Error: Could not resolve authentication method. Expected either apiKey or authToken to be set.
AI4 min - No.021
Fix: typescript-eslint does not support TS 7.0 (ESLint on TS 7)
When typescript-eslint will support TypeScript 7, why npm refuses the install, and the setup that keeps TypeScript 7 while ESLint runs normally today.
> npm error code ERESOLVE
FIXED4 min - No.020
Fix: The OPENAI_API_KEY environment variable is missing or empty
OpenAI's SDK or Codex CLI says your key is missing, though it's in .env. Every wording and its fix, plus the 401 you get when an old key wins.
> OpenAIError: The OPENAI_API_KEY environment variable is missing or empty; either provide it,
AI7 min - No.019
TypeScript 7 with ts-jest, ESLint, ts-node: 9 tools tested
Plain TypeScript 7 broke ts-node, ts-jest, typescript-eslint, TypeDoc and ts-loader, and npm refused to install it at all without a flag. Microsoft's side-by-side setup ran all 9 tools with no errors while tsc stayed on 7.
TESTED9 min - No.018
"Cannot find native binding" in Vite 8: the missing @rolldown file
Vite 8 fails with "Cannot find native binding" and names @rolldown/binding-wasm32-wasi? That's a fallback, not your missing package. Both causes, and the fix.
> Error: Cannot find native binding. npm has a bug related to optional dependencies
FIXED8 minWindows - No.016
'vite' is not recognized as an internal or external command
Windows says the command doesn't exist, but it's right there in node_modules. Five causes, how to tell them apart in one command, and what each one needs.
> 'vite' is not recognized as an internal or external command,
FIXED6 minWindows - No.015
Fix: Cannot read properties of undefined (reading 'fileExists')
ts-node or ts-loader crashing with "reading 'fileExists'" on TypeScript 7? Reproduced on Windows 11 and Ubuntu, before your code even runs: four ways out.
> C:\project\node_modules\ts-node\dist\configuration.js:91
FIXED5 min - No.014
TS1294: syntax not allowed with 'erasableSyntaxOnly', fixed
TS1294: TypeScript rejects your enum, namespace or constructor shorthand. Why new projects turn this on, what each piece becomes, and when to switch it off.
> src/a.ts(1,6): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
FIXED4 min - No.013
Fix: ERR_MODULE_NOT_FOUND Cannot find module in ES modules
Node can't find a file that is clearly there. What ES modules changed about relative imports, why TypeScript path aliases break at runtime, and what to change.
> node:internal/modules/esm/resolve:275
FIXED4 min - No.012
Unknown file extension ".ts" (ERR_UNKNOWN_FILE_EXTENSION)
Node refuses to run your TypeScript file. The version where this stops happening, what ts-node has to do with it, and the one-line way to run .ts today.
> node:internal/modules/esm/get_format:189
FIXED5 min - No.011
Bun vs Node.js 24 benchmark: startup, TypeScript and tests
Bun started 1.7× faster, ran a TypeScript file 3× faster and finished the same test suite 5× faster. The tight number-crunching loop was close: Node won it on Bun 1.4.2, and on 1.4.3 it was a toss-up. The HTTP test hit a limit of this machine, not of either runtime.
TESTED5 min - No.005
Fix: ERR_REQUIRE_ESM require() of ES Module not supported
require() of an ES module: which Node versions throw ERR_REQUIRE_ESM (tested 20 to 26), the .default trap after upgrading, top-level await, and fixes.
> Error [ERR_REQUIRE_ESM]: require() of ES Module ...\node_modules\chalk\source\index.js
FIXED4 min - No.004
digital envelope routines::unsupported (ERR_OSSL_EVP): fix
error:0308010C on webpack 4 and Create React App 4, tested on Node 16 to 26. Which fix works where: webpack 4.47.0, hashFunction, the legacy flag, CRA 5.
> Error: error:0308010C:digital envelope routines::unsupported
FIXED3 min - No.003
Windows 11 address already in use: 3 traps beyond taskkill
Address already in use on Windows 11 (EADDRINUSE), but the PID is Docker, WSL or nothing at all. Reproduced: when not to kill it, and which port to pick.
> node:events:486
FIXED6 minWindows - No.002
Fix: require, __dirname not defined in ES module scope
ReferenceError: require, __dirname or __filename is not defined in ES module scope. Why Node says it, and the fixes, tested on Node 24 and 26.
> ReferenceError: __dirname is not defined in ES module scope
FIXED4 min - No.001
Fix: “Cannot use import statement outside a module”
Why Node, Jest, TypeScript output or your browser refuses import (or throws Unexpected token 'export'), and the fix for each. Tested on Node 20 to 26.
> SyntaxError: Cannot use import statement outside a module
FIXED6 min
Post card · Every Sunday
What broke this week.
One email on Sundays: the Node, TypeScript, Python and AI SDK releases that broke builds that week, each one reproduced, with a link to the fix that worked. Never shared, and you can leave any time.
— Nilay