Companion issue to pnpm issue Replit version of pnpm hangs during version switching · Issue #14000 · pnpm/pnpm · GitHub
On Replit, pnpm -v hangs during version switching when a pnpm-workspace.yaml is present, eventually recursively spawning pnpm add pnpm@... commands until system resources are exhausted
As shown below, this reproduces with both:
A) Replit’s pnpm@10.26.1
B) latest pnpm@11.22.0
Reproduction
-
Create a new empty project on Replit: visit Sign Up - Replit and click the
Create empty projectbutton -
Click the
Open Libraryicon at the top right (the square divided by a horizontal line), then click theFilesbutton at the top to show the files in the project -
Click the
+at the top, to the right ofToolsandPreview, and selectShellto open a terminal tab -
Run
pnpm -vand install Replit’s Node tools when prompted:~/workspace$ pnpm -v Install Replit's Node tools [y/n] y 10.26.1 -
Init a
package.json, create an emptypnpm-workspace.yaml(required for repro), then switch to a different pnpm version:~/workspace$ pnpm init Wrote to /home/runner/workspace/package.json { "name": "workspace", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "packageManager": "pnpm@10.26.1" } ~/workspace$ pnpm -v 10.26.1 ~/workspace$ touch pnpm-workspace.yaml ~/workspace$ pnpm pkg set packageManager="pnpm@10.26.2" ~/workspace$ cat package.json { "name": "workspace", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "packageManager": "pnpm@10.26.2" } -
Run
pnpm -v- observe that it hangs
~/workspace$ pnpm -vIf you wait long enough, pnpm eventually exhausts the available resources after recursively spawning the same version-switch command, followed by many repeated errors:
node[1869]: pthread_create: Resource temporarily unavailable Warning: Failed to load CA certificates off thread: resource temporarily unavailable ERROR Command was killed with SIGABRT (Aborted): pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add ERROR Command failed with exit code 1: pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add ERROR Command failed with exit code 1: pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add ... ERROR Command failed with exit code 1: pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add ERROR Command failed with exit code 1: pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add ERROR Command failed with exit code 1: pnpm add pnpm@10.26.2 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin For help, run: pnpm help add
This is also reproducible with the latest version pnpm@11.22.0 - upgrade with this:
-
Delete the
pnpm-workspace.yamlfile if present (workaround required to switch versions) -
Open the
.replitfile in theFilespane on the right -
Change
nodejs-20tonodejs-22 -
Click the
+at the top, to the right ofToolsandPreview, and selectShellto open a terminal tab -
Set and switch to pnpm 11.22.0:
~/workspace$ pnpm pkg set packageManager="pnpm@11.22.0" ~/workspace$ pnpm -v 11.22.0 -
Create an empty
pnpm-workspace.yaml, switch the version and runpnpm -v- observe that it hangs
~/workspace$ touch pnpm-workspace.yaml ~/workspace$ pnpm pkg set packageManager="pnpm@11.21.0" ~/workspace$ pnpm -v
Investigation
I investigated a bit, and it seems like this problem may be related to Replit’s directory structure ($XDG_DATA_HOME and the pnpm store are inside the project directory - which is called /home/runner/workspace on Replit) ![]()
~/workspace$ printf '%s\n' \
"PWD=$PWD" \
"HOME=$HOME" \
"REPL_HOME=${REPL_HOME-}" \
"XDG_DATA_HOME=${XDG_DATA_HOME-}" \
"XDG_CONFIG_HOME=${XDG_CONFIG_HOME-}" \
"PNPM_HOME=${PNPM_HOME-}"
PWD=/home/runner/workspace
HOME=/home/runner
REPL_HOME=/home/runner/workspace
XDG_DATA_HOME=/home/runner/workspace/.local/share
XDG_CONFIG_HOME=/home/runner/workspace/.config
PNPM_HOME=
~/workspace$ pnpm store path
/home/runner/workspace/.local/share/pnpm/store/v10
The Replit-provided pnpm is installed via Nix, while pnpm’s downloaded version used for version switching is inside the repository directory:
~/workspace$ which pnpm
/nix/store/61lr9izijvg30pcribjdxgjxvh3bysp4-pnpm-10.26.1/bin/pnpm
~/workspace$ find "$XDG_DATA_HOME/pnpm/.tools/pnpm" -maxdepth 2 -type d -print
/home/runner/workspace/.local/share/pnpm/.tools/pnpm
/home/runner/workspace/.local/share/pnpm/.tools/pnpm/11.22.0_tmp_3402
/home/runner/workspace/.local/share/pnpm/.tools/pnpm/11.22.0_tmp_3402/node_modules
/home/runner/workspace/.local/share/pnpm/.tools/pnpm/11.22.0_tmp_3402/bin
This means pnpm’s downloaded version is running from inside the same repository directory containing the pnpm-workspace.yaml
Upstream
The pnpm 10.26.1 behavior also looks similar to pnpm issue #11337 and PR #11346, both linked from the companion issue above
Environment
Replit default:
Node.js 20.20.0
pnpm 10.26.1
Ubuntu 24.04.4 LTS
Latest pnpm repro:
Node.js 22.22.0
pnpm 11.22.0
Ubuntu 24.04.4 LTS
Expected behavior
pnpm should switch versions without hanging