Skip to content

pnpm 12 cannot run because native binaries cannot execute in StackBlitz WebContainers #2151

Description

@karlhorky

Companion StackBlitz issue to pnpm issue pnpm/pnpm#14018

Describe the bug

pnpm 12 cannot run in StackBlitz WebContainers because pnpm 12 uses a native executable which WebContainers cannot execute.

Installing pnpm 12 with npm results in a launcher that does not run pnpm (also when directly installing and running the Linux x64 ELF binary via @pnpm/exe.linux-x64).

Link to the blitz that caused the error

https://stackblitz.com/edit/github-fuwsaec6?file=pnpm-workspace.yaml

Steps to reproduce

  1. Visit the reproduction URL above
  2. Install pnpm 12 using the StackBlitz writable-prefix workaround detailed in issue #2149
    ~/projects/github-fuwsaec6
    ❯ npm install --global --prefix "$HOME/.local" pnpm@next-12
    
    changed 1 package in 6s
  3. Attempt to print the pnpm 12 version number or install dependencies, and observe that neither command runs pnpm successfully 💥
    ~/projects/github-fuwsaec6
    ❯ "$HOME/.local/bin/pnpm" --version
    jsh 1.0 (x64-linux)
    
    ~/projects/github-fuwsaec6
    ❯ "$HOME/.local/bin/pnpm" install
    /home/.local/bin/pnpm: line 4: a command can only contain words and redirects

Attempts to run pnpm 12 via npx or directly installing the Linux x64 executable package @pnpm/exe.linux-x64 also fail in the same way:

~/projects/github-fuwsaec6 10s
❯ npx --yes pnpm@next-12 --version
jsh 1.0 (x64-linux)

~/projects/github-fuwsaec6 9s
❯ npx --yes pnpm@next-12 install
/home/.npm/_npx/4ba242780a651c33/node_modules/.bin/pnpm: line 4: a command can only contain words and redirects

~/projects/github-fuwsaec6
❯ npm install --prefix "$HOME/pnpm12-test" @pnpm/exe.linux-x64@12.0.0-rc.7
npm error code EBADPLATFORM
npm error notsup Unsupported platform for @pnpm/exe.linux-x64@12.0.0-rc.7: wanted {"os":"linux","cpu":"x64","libc":"glibc"} (current: {"os":"linux","cpu":"x64","libc":null})
npm error notsup Valid os:    linux
npm error notsup Actual os:   linux
npm error notsup Valid cpu:   x64
npm error notsup Actual cpu:  x64
npm error notsup Valid libc:  glibc
npm error notsup Actual libc: null

~/projects/github-fuwsaec6
❯ npm install --prefix "$HOME/pnpm12-test" --force @pnpm/exe.linux-x64@12.0.0-rc.7
npm warn using --force Recommended protections disabled.

added 1 package in 2s

~/projects/github-fuwsaec6
❯ "$HOME/pnpm12-test/node_modules/@pnpm/exe.linux-x64/pnpm" --version
jsh 1.0 (x64-linux)

Investigating a bit further, the installed pnpm 12 executable starts with the ELF magic bytes 0x7F 45 4C 46 (127, 69, 76, 70 in decimal), confirming that it is a native Linux ELF binary:

~/projects/github-fuwsaec6
❯ node --input-type=module --eval "import fs from 'node:fs'; const b = fs.readFileSync('$HOME/pnpm12-test/node_modules/@pnpm/exe.linux-x64/pnpm'); console.log([...b.subarray(0, 4)], b.subarray(1, 4).toString())"
[ 127, 69, 76, 70 ] ELF

Expected behavior

pnpm 12 can run and install dependencies in StackBlitz WebContainers.

More generally, WebContainers should consider recommending support pathways for package managers such as pnpm 12 (and other software) that use native Linux executables.

Parity with Local

Screenshots

No response

Platform

  • OS: macOS Tahoe 26.5.2 (25F84)
  • Browser: Chrome
  • Version: 151.0.7922.138 (macOS)

Additional context

Related issues:

In pnpm/pnpm#14018 (comment), zkochan noted that pnpm 12 may have WASM compat challenges:

as far as I understand v12 would need to be compatible with WASM, which was not possible last I checked

cc @SamVerschueren if this should be reported some other way or in stackblitz/core, let me know

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions