pnpm ERR_PNPM_IGNORED_BUILDS: Migrate to allowBuilds
If pnpm stops with ERR_PNPM_IGNORED_BUILDS, the dependency install reached a package whose lifecycle build script is not approved. In pnpm v11, the setting that controls this boundary is allowBuilds in pnpm-workspace.yaml; an old pnpm block in package.json is not a reliable migration path.
The safe fix is to identify the packages, decide which scripts your project actually needs, and record those decisions in version-controlled configuration. Do not approve every dependency just to make CI green.
What the error means
pnpm can install a package without running its postinstall, install, or other lifecycle build script. That protects an install from automatically executing dependency code, but packages with native binaries or generated artifacts may not work until their scripts are explicitly allowed.
In pnpm v11, strictDepBuilds defaults to true. An unreviewed build script can therefore turn what used to be a warning into a failed install. The pnpm 11 release notes document both the stricter default and the replacement of the old build-dependency settings with allowBuilds.
The error is about a package’s install script, not necessarily about the package being unavailable:
ERR_PNPM_IGNORED_BUILDSIgnored build scripts: esbuild, sharpRun "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.The package names in a real log are the starting point for the review. Do not copy this example into your configuration without checking your own dependency tree.
Inspect the blocked packages first
Run the diagnostic command from the workspace root:
pnpm ignored-buildsIf the command lists a package, inspect why your application needs its build output. Native modules, image processors, browser binaries, and packages that compile optional code are common reasons, but the package name alone is not proof that its script is safe or required.
Check the package’s scripts and the dependency that brought it into the tree:
pnpm why esbuildpnpm view esbuild scripts --jsonUse the exact package and version from your lockfile when reviewing a CI failure. A transitive dependency can change its install behavior in a new release, so record the lockfile change together with the approval decision.
Put approvals in pnpm-workspace.yaml
The v11 configuration is a map from package name patterns to booleans. true allows the package’s build script to run; false records that the package is intentionally denied:
allowBuilds: esbuild: true sharp: true fsevents: falseKeep only the packages that you reviewed. The false entries are useful when a package is expected to be present but must not execute an install script. The pnpm settings reference documents this setting alongside strictDepBuilds.
You can let pnpm update the map interactively:
pnpm approve-buildsOr name the decisions explicitly in a repeatable command:
pnpm approve-builds esbuild sharp !fseventsThe current approve-builds documentation supports positional package names and uses ! to deny a package. Review the resulting YAML diff before committing it.
Migrate a pnpm v10 project
An older project may still have configuration like this in package.json:
{ "pnpm": { "onlyBuiltDependencies": ["esbuild"], "ignoredBuiltDependencies": ["fsevents"] }}pnpm v11 no longer reads the pnpm field in package.json for these settings. Move the decisions to pnpm-workspace.yaml:
allowBuilds: esbuild: true fsevents: falseThe official v10-to-v11 migration guide includes a codemod that consolidates the old build-dependency settings into allowBuilds. Run it in a branch, inspect every generated entry, and test the install on the same Node.js version used by CI.
Do not keep two competing sources of truth and assume pnpm will merge them. A configuration that works with one pnpm major can be silently ignored by another.
Make CI use the same decision
Commit pnpm-workspace.yaml and run a clean, frozen install in CI:
rm -rf node_modulespnpm install --frozen-lockfilepnpm run buildThe rm -rf node_modules line is useful for a local migration check; in CI, use the runner’s clean workspace or explicitly invalidate a cache when you need to prove that no old build artifacts are masking the result. Keep the lockfile and the pnpm version pinned so local and CI installs evaluate the same dependency graph.
If a package is allowed but its build still fails, that is a second problem. Check the Node.js version, platform-specific optional dependencies, compiler toolchain, and the package’s own installation instructions. Changing strictDepBuilds will not fix a broken native compilation.
Setting strictDepBuilds: false can be a temporary compatibility bridge while migrating, but it hides the review signal and should not replace an allowlist:
strictDepBuilds: falseallowBuilds: esbuild: truePrefer an explicit allowBuilds map for production and CI. Avoid a global allow-all setting unless you have a separate supply-chain review process for every install script.
Verify the result at the install boundary
After editing the configuration, verify the same path that failed:
- Run
pnpm ignored-buildsand confirm the remaining packages are intentional. - Remove stale
node_modulesor use a clean CI runner. - Run
pnpm install --frozen-lockfile. - Run the build or test command that needs the generated artifact.
- Review the lockfile and
pnpm-workspace.yamlas one change.
If pnpm ignored-builds is empty but the application still cannot load a native module, inspect the package’s runtime error instead of adding more approvals. If the install still reports a package that is already in allowBuilds, check whether the configuration is in the workspace root and whether the CI job is actually using pnpm v11.
The practical rule is to treat ERR_PNPM_IGNORED_BUILDS as a dependency trust decision. Approve the smallest reviewed set, keep it in the workspace configuration, and make CI reproduce that decision from a clean install.
The existing ERR_PNPM_WORKSPACE_PKG_NOT_FOUND guide covers a different pnpm boundary: package discovery and workspace globs. Do not use a workspace glob change to solve an ignored build script.
FAQ
Q: Why does pnpm say a build script is ignored?
A: pnpm found a dependency lifecycle script that is not allowed by the project’s build policy. In v11, inspect it with pnpm ignored-builds and add a deliberate allowBuilds entry when the package really needs to run that script.
Q: Where should allowBuilds be configured?
A: Put it in the workspace configuration, normally pnpm-workspace.yaml. pnpm v11 moved pnpm-specific settings out of the pnpm field in package.json and out of most .npmrc settings.
Q: Should I set strictDepBuilds: false to unblock CI?
A: Only as a short-lived migration bridge. It suppresses the failure signal but does not document which dependency scripts your project trusts. Keep an explicit allowBuilds map for a reproducible CI install.
Q: Does approving a build script guarantee that the package will work?
A: No. Approval only permits the install script to run. The package can still fail because of its Node.js version, operating system, compiler dependencies, optional dependency selection, or a separate runtime configuration problem.
References:
Report a typo or broken link, or suggest a related topic.