Skip to content

fix(addon): fix Docker build failure under pnpm 11 (ERR_PNPM_IGNORED_BUILDS)#6

Open
YangXu1990uiuc wants to merge 1 commit into
dkmaker:mainfrom
YangXu1990uiuc:fix/pnpm11-build-scripts
Open

fix(addon): fix Docker build failure under pnpm 11 (ERR_PNPM_IGNORED_BUILDS)#6
YangXu1990uiuc wants to merge 1 commit into
dkmaker:mainfrom
YangXu1990uiuc:fix/pnpm11-build-scripts

Conversation

@YangXu1990uiuc

Copy link
Copy Markdown

Fixes #4

Problem

The Supervisor build of the add-on fails on all architectures at the mcp-builder stage:

[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: better-sqlite3@11.10.0, esbuild@0.28.1, onnxruntime-node@1.21.0, protobufjs@7.6.5, sharp@0.34.5

Root cause chain:

  1. The Dockerfile installs pnpm unpinned (npm install -g pnpm), so builds silently moved to pnpm 11 when it became latest.
  2. pnpm 11 no longer reads the pnpm field in package.json (the build log warns about this), so the existing pnpm.onlyBuiltDependencies: ["better-sqlite3"] allowlist is ignored. Its replacement is allowBuilds in pnpm-workspace.yaml (available since pnpm 10.26, see https://pnpm.io/settings).
  3. With no allowlist in effect, strictDepBuilds (default true) treats every dependency build script as unreviewed and hard-fails the install. Under strictDepBuilds, every package that wants to run a build script must be listed explicitly — which is why the new file lists all five, not just better-sqlite3.
  4. A side issue made this harder to diagnose: the repo ships no pnpm-lock.yaml, so pnpm install --frozen-lockfile always fails with ERR_PNPM_NO_LOCKFILE, but the error was hidden by 2>/dev/null || pnpm install.

Note: the pnpm approve-builds --yes workaround suggested in #4 doesn't address the config migration; the declarative allowBuilds file is the intended replacement.

Changes

  • Add addon/mcp-server/pnpm-workspace.yaml with the allowBuilds allowlist. better-sqlite3: true (needs its native build); esbuild, onnxruntime-node, protobufjs and sharp are set to false, which reproduces exactly the behavior that shipped under pnpm 10 (their scripts were skipped by onlyBuiltDependencies and the add-on worked).
  • COPY the new file into the builder stage before pnpm install so the allowlist is actually in effect during the Docker build.
  • Pin pnpm to major 11 (npm install -g pnpm@11) so a future major can't silently break the build again.
  • Stop swallowing install errors: replace pnpm install --frozen-lockfile 2>/dev/null || pnpm install with an explicit lockfile-presence check.
  • Bump add-on version to 0.1.12 with a changelog entry.

The old pnpm.onlyBuiltDependencies field in package.json is kept for compatibility with pnpm < 10.26 (pnpm 11 prints a one-line warning that it's ignored; harmless).

Validation

Built the previously-failing stage locally from the addon/ directory:

docker build --target mcp-builder -t test-mcp-builder .

Completes successfully end-to-end on amd64: pnpm install passes, the build-time doc index is created (355 markdown files — this exercises the compiled better-sqlite3 native module), tsc compiles, and pnpm prune --prod succeeds.

🤖 Generated with Claude Code

pnpm 11 no longer reads the "pnpm" field in package.json, so the
onlyBuiltDependencies allowlist was silently ignored. With strictDepBuilds
(default true) every dependency build script then hard-fails install with
ERR_PNPM_IGNORED_BUILDS, breaking the Supervisor build on all architectures.

- Add mcp-server/pnpm-workspace.yaml with the new allowBuilds allowlist:
  better-sqlite3 needs its native build; esbuild, onnxruntime-node,
  protobufjs and sharp keep their scripts disabled, matching the behavior
  that shipped with pnpm 10
- COPY pnpm-workspace.yaml into the mcp-builder stage before pnpm install
- Pin pnpm to major version 11 so future majors can't silently break builds
- Replace the error-swallowing `pnpm install --frozen-lockfile 2>/dev/null
  || pnpm install` with an explicit lockfile-presence check

Fixes dkmaker#4

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Issue while trying to install on HA OS on Raspberry Pi 5

1 participant