Skip to content

npm 12 blocks pnpm install scripts, so Turbo jobs fail with "Exec format error" #1

Open

Description

@blendsdk

npm 12 blocks pnpm's install scripts, so Turbo jobs fail with Exec format error

Summary

After the runner image picked up npm 12 (via npm install -g npm@latest in Dockerfile:68), every
Turbo-based job fails before tests start:

$ pnpm run self:clean && turbo run clean
##[error]command finished with error: Exec format error (os error 8)
@blendsdk/webafx-i18n#clean:  ERROR  command finished with error: Exec format error (os error 8)
...
Tasks:    0 successful, 21 total

npm 12 blocks dependency lifecycle scripts by default unless the package is covered by
allowScripts. pnpm's preinstall/postinstall (node install.js) is what replaces pnpm's
shebang-less wrapper with the platform-native binary. Because the script is blocked, the
placeholder stays in place; shells can still run it, but Turbo spawns the resolved pnpm binary
directly and gets ENOEXEC.

Impact

  • Any job that runs Turbo (turbo run ...) after npm install -g pnpm@<version> fails
    immediately, before build or tests. Observed in TrueSoftwareNL/blendsdk (run
    37159998714, 2026-10-06).
  • Jobs that only call pnpm through a shell (pnpm install, pnpm run ...) still pass, which
    makes the failure look like a Turbo problem rather than an npm/pnpm packaging problem.
  • Affects every organization whose repositories use Turbo plus a global pnpm install. The
    blendsdk repo is the known case; others may be affected after the next image rebuild.

Environment

Item Value
Runner image built from this repository (Dockerfile)
Base Ubuntu 24.04
Runner actions/runner 2.337.0
Node installed at build via nvm install --lts (Dockerfile:65-68) and re-checked at every container start (start.sh:50)
npm npm 12 (installed via npm install -g npm@latest, Dockerfile:68)
pnpm any version installed with npm install -g pnpm@..., e.g. 12.8.1

Symptoms

  1. During Install dependencies, the job logs:

    npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
    npm warn install-scripts   pnpm@12.8.1 (preinstall: node install.js; postinstall: node install.js)
    npm warn install-scripts Run `npm install -g --allow-scripts=pnpm` to allow these scripts once, or
    `npm config set allow-scripts=pnpm --location=user` to allow them for all global installs.
    

    The previous runner (npm 11) only warned and still ended up with a working native binary:

    npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
    npm warn allow-scripts   pnpm@12.8.1 (preinstall: node install.js; postinstall: node install.js)
    
  2. Turbo then fails every task:

    $ pnpm run self:clean && turbo run clean
    $ rm -rf .turbo
    • Packages in scope: ...
    • Running clean in 22 packages
    ##[error]command finished with error: Exec format error (os error 8)
    ...
    ##[error]unable to spawn child process: Exec format error (os error 8)
    ...
    Tasks:    0 successful, 21 total
    

Root cause

  1. npm 12 blocks dependency lifecycle scripts by default unless covered by allowScripts
    (npm/cli PR #9838; change introduced in commit
    5cd5150,
    released as an npm 12 breaking change). This image installs npm@latest, so rebuilds after the
    npm 12 release started shipping npm 12.
  2. The pnpm npm package ships its pnpm entry point as a shebang-less placeholder (an sh
    script is not required; it is designed to fall back to bin/pnpm.mjs via Node). The package's
    install.js replaces that placeholder with the host's native binary; npm 12 blocks that script,
    so the placeholder remains.
  3. Why shell calls still work: POSIX shells handle ENOEXEC by retrying the file through sh, so
    pnpm install, pnpm build, and other workflow steps succeed.
  4. Why Turbo fails: Turbo 2.10 runs each package script by resolving the package-manager binary and
    executing it directly (crates/turborepo-task-executor/src/command.rs, Command::new(spec.program)
    via package_manager_binary()), with no shell fallback. The placeholder is not a valid
    executable, so every spawn fails with Exec format error (os error 8).

Relevant files in this repository:

File Relevance
Dockerfile:46-50 copies host .npmrc to /home/docker/.npmrc
Dockerfile:61-68 USER docker; nvm install --lts; npm install -g npm@latest yarn pnpm
start.sh:50 nvm install --lts on every container start (refreshes the runtime npm)
entrypoint.sh:109-110 runs the runner as user docker with HOME=/home/docker
test/dockerfile.spec.test.sh:39-40 existing static checks for globally installed package managers

Reproduction

With a staged build context (the image build needs the host credential files):

docker build -t build-server:test .
docker run --rm --privileged build-server:test bash -lc '
  npm --version                       # expect 12.x
  npm install -g pnpm@12.8.1
  file "$(readlink -f "$(which pnpm)")"   # currently: ASCII text (placeholder)
'

The second command prints the install-scripts ... blocked warning, and file reports a text
placeholder instead of an ELF binary.

Recommended fix

Allowlist only pnpm's lifecycle script; do not blanket-enable all dependency scripts. Any one of
these is sufficient (Option A or B preferred; both keep the npm 12 supply-chain protection and
apply to every job in the container):

Option Change Notes
A (recommended) Add ENV NPM_CONFIG_ALLOW_SCRIPTS=pnpm to Dockerfile, next to ENV NVM_DIR=/home/docker/.nvm (Dockerfile:64) One line; applies to the image build and every job step; environment config outranks the user .npmrc; no file ownership concerns when nvm install --lts switches Node versions at runtime
B Append allow-scripts=pnpm to the staged /home/docker/.npmrc and make sure the runner user can read it (for example chown docker:docker /home/docker/.npmrc) Matches npm's own npm config set allow-scripts=pnpm --location=user recommendation; verify the staged file's mode, since the runner runs as docker
C (workaround, not in this repo) Pass --allow-scripts=pnpm to npm install -g pnpm@... in each dependent workflow Requires touching every workflow and does not fix other repositories

Also check whether the globally installed yarn (Dockerfile:68) needs the same treatment for the
organizations that use it. That is a separate decision and is not required for the reported failure.

Acceptance criteria

  • After rebuilding the image and restarting a runner container:
    • npm config get allow-scripts returns pnpm, or NPM_CONFIG_ALLOW_SCRIPTS=pnpm is present in
      the runner environment (check with printenv NPM_CONFIG_ALLOW_SCRIPTS).
    • npm install -g pnpm@12.8.1 emits no install-scripts ... blocked warning.
    • file "$(readlink -f "$(which pnpm)")" reports an ELF 64-bit executable.
    • A Turbo job succeeds at pnpm clean && pnpm build (turbo run clean completes without
      Exec format error).
  • Recommended, matching the repository's spec-first convention: extend
    test/dockerfile.spec.test.sh with an assertion that the image allows pnpm's install scripts
    (for example, grep -Eq 'NPM_CONFIG_ALLOW_SCRIPTS=pnpm|allow-scripts=pnpm' "${DOCKERFILE}").
  • Run bash test/verify.sh before opening the change.

References

  • npm/cli PR #9838 "docs: document npm 12 install script blocking" and commit 5cd5150.
  • npm package pnpm@12.8.1: package.json (preinstall/postinstall: node install.js),
    install.js, and the shebang-less pnpm placeholder.
  • Turborepo 2.10.8: crates/turborepo-task-executor/src/command.rs (direct package-manager spawn).
  • Failed downstream run: TrueSoftwareNL/blendsdk actions run 37159998714 (2026-10-06).

Activity

  1. added
    bug
    on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions