[ERR_PNPM_UNEXPECTED_STORE] Unexpected store location when adding pnpm packages to Task Runners

Hi everyone,

I recently faced this issue and managed to solve it. I wanted to post my findings here in case this isn’t intended behavior, or in case it helps someone else.

The Issue

After the latest “beta” version [2.29.5] of the task runners, I started getting this error when trying to build a custom runner image:

#13 [stage-1 7/8] RUN cd /opt/runners/task-runner-javascript &&     pnpm add     moment     uuid
#13 0.829 ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.10.0.tgz
#13 2.407 [ERR_PNPM_UNEXPECTED_STORE] Unexpected store location
#13 2.407 
#13 2.407 The dependencies at "/opt/runners/task-runner-javascript/node_modules" are currently linked from the store at "/root/.local/share/pnpm/store/v10".
#13 2.407 
#13 2.407 pnpm now wants to use the store at "/root/.local/share/pnpm/store/v11" to link dependencies.
#13 2.407 
#13 2.407 If you want to use the new store location, reinstall your dependencies with "pnpm install".
#13 2.407 
#13 2.407 You may change the global store location by running "pnpm config set store-dir <dir> --global".
#13 2.407 (This error may happen if the node_modules was installed with a different major version of pnpm)
#13 ERROR: process "/bin/sh -c cd /opt/runners/task-runner-javascript &&     pnpm add     moment     uuid" did not complete successfully: exit code: 1

The Symptoms

  1. The Store Error: When running a standard pnpm add command in my custom Dockerfile, I got [ERR_PNPM_UNEXPECTED_STORE]. The base image’s node_modules were linked to a v10 store, but my build step was trying to use a v11 store.
  2. The npx Error: I tried forcing pnpm v10 using npx -y pnpm@10 add ..., but the base image is built on python:alpine and only copies the node binary and corepack. It doesn’t include npm or npx, resulting in /bin/sh: npx: not found.

The Root Cause

Looking at n8n’s source code, they recently updated the runner Dockerfiles to explicitly pin PNPM_VERSION=10.32.1 during their build process (Commit 25d0d12).

They did this because pnpm deploy drops the packageManager field, so a bare corepack enable pnpm resolves to pnpm 11.x. pnpm 11 defaults minimumReleaseAge to 24 hours, which rejects dependencies published less than a day ago.

However, if you just run a bare pnpm add in your custom Dockerfile, corepack ignores this pinned version and automatically downloads the newest version (v11). pnpm 11 uses a different store format and refuses to interact with the v10 store left behind by the base image.

The Solution

To fix this, you have to use corepack to explicitly activate pnpm v10 before running your pnpm add command.

Instead of doing this:

RUN cd /opt/runners/task-runner-javascript && \
    pnpm add moment uuid

Change your Dockerfile step to this:

# Activate pnpm 10.32.1 to match the base image's v10 store (npx is not available in this image)
RUN corepack prepare pnpm@10.32.1 --activate && \
    cd /opt/runners/task-runner-javascript && \
    pnpm add \
    moment \
    uuid

Hope this saves someone else a few hours of debugging! I’d also appreciate it if someone could confirm whether pinning to v10 is the expected behavior moving forward.

Great share, @mohamed3nan !!

Thanks for this, I have created CAT-3666 as the internal dev ticket to get this fixed.

Thanks for finding that fix @mohamed3nan . it saved me a lot of investigation!. It is a little fragile if they change the version so I have updated it to explicitly read the current version like so:

RUN PNPM_VER=$(sed -n 's/.*"packageManager": "pnpm@\([^"]*\)".*/\1/p' /opt/runners/task-runner-javascript/node_modules/.modules.yaml) && \
    corepack prepare pnpm@${PNPM_VER} --activate && \
    cd /opt/runners/task-runner-javascript && \
    pnpm add \
        <list-of-packages>

Hopefully there will be a proper fix before the version changes but better to be safe.

Update: the store issue is fixed, but a new one took its place…

Details below (writeup drafted with my AI assistant, everything verified on my own instance):

#36424 bumps PNPM_VERSION in docker/images/runners/Dockerfile from 10.32.1 to 11.22.0, so the image’s node_modules and the pnpm you get are both on v11 — no more v10/v11 mismatch. Corepack is out of the picture too: Node no longer bundles it and the runtime image has no npm, so pnpm is now copied straight in as a package:

COPY --from=node-alpine /usr/local/lib/node_modules/pnpm /usr/local/lib/node_modules/pnpm
RUN ln -s ../lib/node_modules/pnpm/bin/pnpm.cjs /usr/local/bin/pnpm

Extending the image is still broken though, just differently — that symlink target ships without an execute bit:

$ docker run --rm --entrypoint sh n8nio/runners:beta -c 'ls -lL /usr/local/bin/pnpm'
-rw-r--r--    1 root     root           105 Aug 25 13:35 /usr/local/bin/pnpm

(image digest sha256:b6b5f79826a6d41422338e6a3b0b0d56750835dac844d8df630153ddf348dc38)

So any pnpm call in a derived image fails:

#13 [stage-1 7/8] RUN cd /opt/runners/task-runner-javascript && pnpm add moment uuid
#13 0.144 /bin/sh: pnpm: Permission denied
#13 ERROR: process "/bin/sh -c cd /opt/runners/task-runner-javascript && pnpm add moment uuid" did not complete successfully: exit code: 126

Exit 126 means found but not executable. USER root doesn’t help here — root bypasses read and write permission checks, but not execute: a file with no execute bits set can’t be run by anyone.

Worth noting the failing command is copied verbatim from Adding extra dependencies in the docs, so anyone following that page on beta will hit it.

Workaround — chmod the target before using pnpm:

RUN chmod +x /usr/local/lib/node_modules/pnpm/bin/pnpm.cjs && \
    cd /opt/runners/task-runner-javascript && \
    pnpm add \
    moment \
    uuid

Or skip the exec bit entirely and go through node:

RUN cd /opt/runners/task-runner-javascript && \
    node /usr/local/lib/node_modules/pnpm/bin/pnpm.cjs add moment uuid

The fix on your side is presumably COPY --chmod=755 on that layer, or a chmod +x after the ln -s.