From c0f0a15f92ce4385e43b232983af6b6d322e51dc Mon Sep 17 00:00:00 2001 From: Yang Date: Sun, 12 Jul 2026 12:30:37 -0700 Subject: [PATCH] fix(addon): fix Docker build failure under pnpm 11 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 #4 Co-Authored-By: Claude Fable 5 --- addon/CHANGELOG.md | 11 +++++++++++ addon/Dockerfile | 13 ++++++++++--- addon/config.yaml | 2 +- addon/mcp-server/pnpm-workspace.yaml | 13 +++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 addon/mcp-server/pnpm-workspace.yaml diff --git a/addon/CHANGELOG.md b/addon/CHANGELOG.md index 72a5e3a..987387f 100644 --- a/addon/CHANGELOG.md +++ b/addon/CHANGELOG.md @@ -1,3 +1,14 @@ +## 0.1.12 + +### Bug fixes + +- Fix Docker build failure with pnpm 11 (`ERR_PNPM_IGNORED_BUILDS`, #4): move the + dependency build-script allowlist from the no-longer-read `pnpm` field in + package.json to `allowBuilds` in `pnpm-workspace.yaml` +- Pin pnpm to major version 11 so future pnpm releases can't silently break the build +- Stop hiding pnpm install errors behind `2>/dev/null`; pick frozen vs regular + install based on whether a lockfile is present + ## 0.1.11 ### Improvements diff --git a/addon/Dockerfile b/addon/Dockerfile index d4cf8f4..f882603 100644 --- a/addon/Dockerfile +++ b/addon/Dockerfile @@ -9,8 +9,11 @@ ARG BUILD_FROM=ghcr.io/hassio-addons/base:20.0.1 # compile against the same Node.js version and musl libc. FROM alpine:3.23 AS mcp-builder +# Pin the pnpm major version — pnpm 11 removed support for the "pnpm" field in +# package.json and renamed the build-script allowlist to allowBuilds in +# pnpm-workspace.yaml. An unpinned install broke this build once already (#4). RUN apk add --no-cache nodejs npm git build-base python3 && \ - npm install -g pnpm + npm install -g pnpm@11 WORKDIR /build @@ -22,8 +25,12 @@ RUN git clone --depth 1 --branch "${DOCS_REF}" "${DOCS_REPO}" /tmp/repo && \ rm -rf /tmp/repo # Install MCP server dependencies -COPY mcp-server/package.json mcp-server/pnpm-lock.yaml* ./mcp-server/ -RUN cd mcp-server && pnpm install --frozen-lockfile 2>/dev/null || pnpm install +# pnpm-workspace.yaml carries the allowBuilds allowlist and must be present +# before install, or pnpm refuses to run dependency build scripts. +COPY mcp-server/package.json mcp-server/pnpm-workspace.yaml mcp-server/pnpm-lock.yaml* ./mcp-server/ +RUN cd mcp-server && \ + if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; \ + else pnpm install; fi # Copy MCP server source COPY mcp-server/ ./mcp-server/ diff --git a/addon/config.yaml b/addon/config.yaml index 672bcd4..4a6c72f 100644 --- a/addon/config.yaml +++ b/addon/config.yaml @@ -1,6 +1,6 @@ --- name: Claude Code -version: 0.1.11 +version: 0.1.12 slug: claude_code description: AI coding assistant with full Home Assistant access startup: services diff --git a/addon/mcp-server/pnpm-workspace.yaml b/addon/mcp-server/pnpm-workspace.yaml new file mode 100644 index 0000000..3b7fd0d --- /dev/null +++ b/addon/mcp-server/pnpm-workspace.yaml @@ -0,0 +1,13 @@ +# pnpm >= 10.26 reads the dependency build-script allowlist from here; the +# "pnpm" field in package.json is no longer read as of pnpm 11. +# With strictDepBuilds (default true), every dependency that wants to run a +# build script must be listed explicitly or install fails with +# ERR_PNPM_IGNORED_BUILDS. +# Only better-sqlite3 needs its native build; the other four worked with their +# scripts skipped under pnpm 10, so keep them disabled. +allowBuilds: + better-sqlite3: true + esbuild: false + onnxruntime-node: false + protobufjs: false + sharp: false