Skip to content

fix(deps): extend pnpm.onlyBuiltDependencies for pnpm@11 compatibility#703

Open
adm-jdlc wants to merge 1 commit into
builderz-labs:mainfrom
adm-jdlc:fix/pnpm-only-built-deps
Open

fix(deps): extend pnpm.onlyBuiltDependencies for pnpm@11 compatibility#703
adm-jdlc wants to merge 1 commit into
builderz-labs:mainfrom
adm-jdlc:fix/pnpm-only-built-deps

Conversation

@adm-jdlc
Copy link
Copy Markdown

Fixes #702.

Summary

Extends pnpm.onlyBuiltDependencies in package.json from 2 to 7 entries so fresh Docker installs work cleanly against pnpm 11.

The current allowlist (better-sqlite3, node-pty) was correct for pnpm 10's permissive default but is incomplete now that pnpm 11 blocks unlisted native build scripts. Five additional packages in the lockfile legitimately need their install/postinstall to run:

Package Why it needs build scripts
@parcel/watcher Native compile via node scripts/build-from-source.js
@swc/core WASM/platform-binary fetch via node postinstall.js
esbuild Platform-binary fetch via node install.js
sharp Platform-binary fetch (or build from source fallback)
unrs-resolver NAPI native via napi-postinstall ... check

vue-demi appears in the warning but is intentionally omitted — its postinstall is a no-op try/catch shim with no side effects, so allowlisting it would add noise.

Test plan

  • bash install.sh --docker from a fresh checkout against pnpm 11.1.3 — completes with no ERR_PNPM_IGNORED_BUILDS warnings.
  • Container starts healthy: GET /api/status?action=health returns {"status":"healthy"}.
  • /setup flow + admin creation work end-to-end.
  • pnpm install (host-side, without Docker) also clean.

Notes

pnpm 11 blocks native build scripts by default unless the package is
listed in pnpm.onlyBuiltDependencies. The current allowlist only contains
better-sqlite3 and node-pty, but the lockfile has 5 more packages with
material install/postinstall logic:

  - @parcel/watcher  (native compile)
  - @swc/core        (platform binary fetch)
  - esbuild          (platform binary fetch)
  - sharp            (platform binary fetch)
  - unrs-resolver    (NAPI native)

Without these, fresh `bash install.sh --docker` runs against pnpm@latest
hit ERR_PNPM_IGNORED_BUILDS, better-sqlite3 silently fails to compile,
and the Dockerfile's postinstall verify step exits non-zero.

vue-demi also appears in the warning but is intentionally omitted: its
postinstall is a no-op try/catch shim with no side effects.

Verified locally: `bash install.sh --docker` completes cleanly with
pnpm 11.1.3 after this change.

Fixes builderz-labs#702
@adm-jdlc adm-jdlc requested a review from 0xNyk as a code owner May 19, 2026 14:58
@adm-jdlc
Copy link
Copy Markdown
Author

Update — found a more nuanced root cause while testing locally.

After landing this fix in my workspace, I ran pnpm add and got:

[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.

So as of pnpm 11+, pnpm.onlyBuiltDependencies in package.json is deprecated and ignored — settings moved to pnpm-workspace.yaml under allowBuilds: (a map of package matchers to true/false).

Two takeaways:

  1. This PR's fix still helps users on pnpm 10.x (which still reads the package.json field), so it's not wrong — but it's a transitional fix.

  2. For pnpm 11+, the canonical fix is to add a pnpm-workspace.yaml like:

    allowBuilds:
      '@parcel/watcher': true
      '@swc/core': true
      better-sqlite3: true
      esbuild: true
      node-pty: true
      sharp: true
      unrs-resolver: true
      vue-demi: false

Notably, when pnpm 11+ runs pnpm add with a missing/incomplete config, it auto-generates pnpm-workspace.yaml with placeholder values reading literally set this to true or false (not true/false), which means the warning persists silently until an operator notices.

Happy to amend this PR to add pnpm-workspace.yaml instead of (or alongside) the package.json change — or split into a follow-up PR if you'd prefer to keep this one minimal. Let me know which you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker build fails with pnpm@latest: ERR_PNPM_IGNORED_BUILDS due to incomplete onlyBuiltDependencies allowlist

1 participant