Skip to content
Nilay Kabariya

Home · Topic · 42 entries

npm errors fixed: install, scripts and npm 12

npm errors rarely say what actually went wrong: a missing script, a peer dependency conflict, an install script npm 12 now blocks, or a native binary that never downloaded. Every entry below was reproduced on a real install with the exact npm and Node versions listed, and the fix was run before it was written up.

Entries

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. No.058

    Claude Code, Codex, Gemini CLI on Windows: install tested

    All five install and start on Windows 11 with npm 11, in cmd, on Node 24 and Node 26. Two things trip people up. On a default Windows PowerShell setup all five fail with "running scripts is disabled on this system". And with npm 12, Claude Code and OpenCode install with no error but then refuse to start: "not compatible with the version of Windows you're running".

    TESTED6 minWindows
  21. 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
  22. 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
  23. 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
  24. No.052

    Next.js 16.3 vulnerabilities: which version is patched?

    Install 16.4.5 or later (or 15.5.29): seven more advisories on November 3 are fixed only there, and 16.4.6 on November 9 adds bug fixes only. On October 14, two critical remote code execution bugs were fixed in 16.4.1 only; every 16.3 release is affected and for days npm audit did not flag them. Before that, 16.3.0 carried 9 published advisories (3 critical) and 16.3.7 carried 6, because the September 30 fixes skipped it. By October 23, npm audit counted 10 on 16.3.7 and 3 on 16.3.8. The upgrade built cleanly on every version I tried. The traps are in the tools: npm audit fix jumps you a minor version or does nothing at all, and next upgrade crashes on Windows.

    TESTED10 minWindows
  25. 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
  26. 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
  27. 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
  28. No.038

    Fix: Puppeteer "Could not find Chrome (ver. …)"

    Puppeteer can't find Chrome though npm install worked. Six causes reproduced on Windows and Linux, including npm 12, upgrades and Docker, each with its fix.

    > Error: Could not find Chrome (ver. 154.0.8037.57). This can occur if either

    FIXED5 minWindows
  29. 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
  30. No.036

    Fix: Claude Code "not compatible with the version of Windows"

    Windows says claude.exe won't run right after an npm install of Claude Code. Your Windows is fine. Reproduced on npm 12, with the reinstall that fixed it.

    > This version of C:\...\claude-code\bin\claude.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

    AGENTS5 minWindows
  31. 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
  32. 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
  33. No.027

    Angular compilation initialization failed on TypeScript 7

    Angular 22 crashes on TypeScript 7 with reading 'Error', not the usual version warning. What actually failed, and the setup that builds with tsc 7, tested.

    > Application bundle generation failed. [0.412 seconds]

    FIXED3 min
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. No.010

    npm vs pnpm vs Yarn vs Bun: install speed benchmark (2026)

    pnpm is the best all-rounder: 2.8× faster than npm from a cold start and near-instant when nothing changed. Bun wins with a warm cache. Yarn 1 was the slowest and needed a 3.7 GB cache.

    TESTED6 min
  40. No.007

    npx tailwindcss init: "could not determine executable to run"

    npx tailwindcss init fails on a fresh install. Why Tailwind v4 does this, two fixes that work, and the command that fails silently. Reproduced.

    > $ npx tailwindcss init

    FIXED2 min
  41. No.006

    Fix: npm ERESOLVE unable to resolve dependency tree (React 19)

    npm ERESOLVE with React 19 or ESLint 10, on npm 11 and 12. Four fixes compared, and why --legacy-peer-deps breaks the next npm ci.

    > npm error code ERESOLVE

    FIXED3 min
  42. 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

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

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text