From 8c2d73e8af844cb10f7057b916d7b64fc0928b34 Mon Sep 17 00:00:00 2001 From: ajnart Date: Mon, 13 Jul 2026 20:06:28 +0200 Subject: [PATCH 1/2] fix(docker): resolve pnpm fetch crash with patchedDependencies PR #6296 introduced pnpm fetch in the Dockerfile for Docker cache optimization. However, pnpm fetch crashes with ENOENT when patchedDependencies are configured with nodeLinker: hoisted because applyPatchToDir tries to chdir into node_modules/ which doesn't exist during fetch (only the content-addressable store is populated). Fix: temporarily switch nodeLinker to isolated during pnpm fetch so patches apply inside the virtual store (node_modules/.pnpm/...) which IS created by pnpm fetch. Restore hoisted before the install step so the final node_modules layout stays flat. Refs: pnpm/pnpm#5268, pnpm/pnpm#8726 --- Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca493aa3c..c01c66d49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,18 @@ RUN apk add --no-cache libc6-compat curl bash && apk update RUN corepack enable pnpm COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./ COPY patches ./patches +# Workaround for pnpm/pnpm#5268: pnpm fetch crashes when patchedDependencies +# are configured with nodeLinker: hoisted. The applyPatchToDir function tries +# to chdir into node_modules/ which doesn't exist during fetch (only the +# content-addressable store is populated). By temporarily switching to the +# isolated linker, patches apply inside the virtual store (node_modules/.pnpm/...) +# which IS created by pnpm fetch. The original hoisted linker is restored +# before the install step so the final node_modules layout stays flat. RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \ - pnpm config set store-dir /pnpm/store && pnpm fetch + pnpm config set store-dir /pnpm/store && \ + sed -i 's/nodeLinker: hoisted/nodeLinker: isolated/' pnpm-workspace.yaml && \ + pnpm fetch && \ + sed -i 's/nodeLinker: isolated/nodeLinker: hoisted/' pnpm-workspace.yaml COPY . . RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \ From b2f63c6e0f854177b9e08d552d61b114354c5d43 Mon Sep 17 00:00:00 2001 From: ajnart Date: Mon, 13 Jul 2026 20:24:59 +0200 Subject: [PATCH 2/2] fix(docker): drop --frozen-lockfile from install step per pnpm fetch docs The pnpm fetch docs recommend `pnpm install -r --offline` without --frozen-lockfile. The --offline flag already enforces no registry access, making --frozen-lockfile redundant. https://pnpm.io/cli/fetch --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c01c66d49..6c003ad10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,11 @@ RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \ sed -i 's/nodeLinker: isolated/nodeLinker: hoisted/' pnpm-workspace.yaml COPY . . +# Follow the pnpm fetch pattern from https://pnpm.io/cli/fetch +# --offline enforces no registry access (all packages are in the store from fetch) +# --frozen-lockfile is omitted as recommended by the pnpm fetch docs RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \ - pnpm install --recursive --offline --frozen-lockfile + pnpm install --recursive --offline ARG SKIP_ENV_VALIDATION='true' ARG CI='true'