Skip to content
Nilay Kabariya

Entry No.105·Fixes··4 min read

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.

The error, verbatim

Jump to the fix ↓
Error: ERR_PNPM_IGNORED_BUILDS
  × installing dependencies
  ╰─▶ Ignored build scripts: esbuild@0.28.2
  help: Run "pnpm approve-builds" to pick which dependencies should be allowed
        to run scripts.

The fix that worked

Decide every package with a build script in pnpm-workspace.yaml:

allowBuilds:
  esbuild: true
Not it? Every cause, tested ↓

Tested on

pnpm
10.34.9, 11.28.11, 12.18.0
Packages
esbuild 0.28.2, lefthook 2.2.1
Node / OS
24.22.2 / Ubuntu (GitHub Actions); 24.14.0 / Windows 11 for the warning text and the pnpm-workspace.yaml check (re-run November 16)

✓ Last re-run on GitHub Actions · see the run · all repros

Every answer that says “add the package to onlyBuiltDependencies” was right for pnpm 10, and that’s the version the answer was written on. On pnpm 11 and 12 the same setting is ignored: in package.json pnpm says so with a warning, and in pnpm-workspace.yaml it said nothing (pnpm 12.18.0 on Windows 11, November 16: no warning, the file untouched, the install still failed). Either way the install still exits 1. The setting that works now is called allowBuilds, and it has one rule the old one didn’t: every package with a build script needs a decision.

In pnpm-workspace.yaml (create it next to package.json if you don’t have one), list each package from the error with true to run its script or false to skip it:

allowBuilds:
  esbuild: true
  lefthook: false

What each pnpm version does with each setting

One project with esbuild 0.28.2 (which has a postinstall script), a clean install every time, November 9, 2026:

Terminal on GitHub Actions: pnpm 10.34.9 exits 0 with every setting and only warns about ignored build scripts with none; pnpm 11.28.11 and 12.18.0 exit 1 with ERR_PNPM_IGNORED_BUILDS with no setting, with pnpm.onlyBuiltDependencies in package.json (plus a warning that the pnpm field is ignored) and with onlyBuiltDependencies in pnpm-workspace.yaml, and exit 0 with allowBuilds esbuild true.
pnpm 10, 11 and 12, four settings each, clean installs. Full log.
Setting pnpm 10.34.9 pnpm 11.28.11 pnpm 12.18.0
none exit 0, warning only exit 1 exit 1
pnpm.onlyBuiltDependencies in package.json exit 0 exit 1 exit 1
onlyBuiltDependencies in pnpm-workspace.yaml exit 0 exit 1 exit 1
allowBuilds in pnpm-workspace.yaml exit 0 exit 0 exit 0

Two things stand out. pnpm 10 never failed the install, it only warned, which is why a project can be fine on one machine and broken in CI where the pnpm version is newer. And on 11 and 12 the package.json route fails loudly while the workspace-file route fails silently. The warning from pnpm 12.18.0 for the package.json field:

[WARN] The "pnpm" field in package.json is no longer read by pnpm. The following keys were ignored: "pnpm.onlyBuiltDependencies". See https://pnpm.io/settings for the new home of each setting.

Every package needs a yes or a no

With two packages that have build scripts (esbuild and lefthook) on pnpm 12.18.0:

allowBuilds Install
esbuild: true only exit 1: lefthook still undecided
esbuild: true, lefthook: false exit 0
esbuild: true, lefthook: true exit 0
esbuild: true, lefthook@2.2.2: true (lockfile has 2.2.1) exit 1
esbuild: true, lefthook@2.2.1: true exit 0

So copy every name from the Ignored build scripts: line, not just the one you care about, and decide each one on purpose: false is a real answer, not a failure. And prefer plain names to name@version keys: a name@version key only covers the versions it names, so the next dependency update can break the install again without any change to your config.

Without editing the file: approve-builds and strictDepBuilds

The error suggests pnpm approve-builds, which asks questions when run on its own. With --all (or with package names as arguments) it doesn’t ask, which makes it usable in a script. On pnpm 12.18.0, after a failed install:

  • pnpm approve-builds --all ran both postinstall scripts, exited 0, and wrote allowBuilds: with esbuild: true and lefthook: true into pnpm-workspace.yaml. A clean install after that exited 0. Commit that file, and CI is fixed too.
  • strictDepBuilds: false in pnpm-workspace.yaml made the install exit 0, but only by downgrading the error to a warning: Ignored build scripts: esbuild@0.28.2, lefthook@2.2.1. The scripts still didn’t run. That’s fine for packages that work without their postinstall step, and wrong for ones that need it, so I’d only use it while you decide.
  • CI=true changed nothing: the install still failed with ERR_PNPM_IGNORED_BUILDS. CI=true alone does not approve anything (pnpm’s settings list a dangerouslyAllowAllBuilds setting; I did not test it).

--all approves every pending script, including any you’d rather not run, so read the list it writes before committing it. Turning an entry to false keeps the install passing without running that script.

Which pnpm am I running?

pnpm -v tells you, and it matters: the same project passed on pnpm 10 and failed on 11 and 12. If your CI installs pnpm without a fixed version, it can move to a newer major on its own. Pinning the version in package.json keeps local and CI on the same one:

"packageManager": "pnpm@12.18.0"

The runs

GitHub Actions ubuntu-latest, Node 24.22.2, November 9, 2026: pnpm 10.34.9, 11.28.11 and 12.18.0 (each via npx pnpm@<major>), each setting in a fresh folder with a clean install (versions.sh, run 42574261589). The two-package table and the approve-builds --all, strictDepBuilds and CI=true checks ran on pnpm 12.18.0 (run 42561921688, run 42576230630). The warning text, the error block and the pnpm-workspace.yaml check were re-run on Windows 11 with Node 24.14.0 and the same pnpm 12.18.0 on November 16, 2026; at that date the newest releases were 11.28.12 and 12.21.0, so the version numbers above are the ones tested on November 9.

— N.K., end of entry No.105

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.103

    Fix: npm error code EALLOWGIT, tested

    npm error code EALLOWGIT: npm 12 blocks git dependencies by default. Every git case tested on npm 12.2.2 and 11.21.2, plus allow-git values.

    > npm error code EALLOWGIT

    FIXED6 min
  2. 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
  3. No.091

    Fix: npm error code EALLOWREMOTE (and EALLOWGIT), tested

    npm error code EALLOWREMOTE and EALLOWGIT: fetching packages of type remote or git disabled. Every case reproduced on npm 12, from npx to npm ci, with fixes.

    > npm error code EALLOWREMOTE

    FIXED4 min

tip: paste the exact error text