Skip to content

Self upgrade does not work if the project is in the user's home and uses pnpm workspaces #9778

Description

@wesleybl

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

No response

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/wesleybl/pnpm-home

Reproduction steps

  • Clone the repository.
  • Build the image.
  • Run the image.
  • Try displaying the pnpm version.
  • Kill pnpm --version to avoid crashing the machine.

Commands:

git clone git@github.com:wesleybl/pnpm-home.git
cd pnpm-home
./build.sh
docker run --rm -it pnpm-home:latest
# In container
pnpm --version
# After 10 seconds, kill the process to avoid crashing the machine
# Ctrl + c

Describe the Bug

If the project is in the user's home and uses pnpm workspaces, pnpm's self-upgrade doesn't work. It tries to download a new pnpm version, but it seems to loop and consume all the machine's memory.

I created a Dockerfile and a project to simulate the error. I have to kill the process to avoid crashing the machine. See error:

$ pnpm --version
^C ERROR  Command was killed with SIGINT (User interruption with CTRL-C): pnpm add pnpm@9.1.1 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=/home/node/.local/share/pnpm/.tools/pnpm/9.1.1_tmp_96/bin
For help, run: pnpm help add
ERROR  Command failed with exit code 1: pnpm add pnpm@9.1.1 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=/home/node/.local/share/pnpm/.tools/pnpm/9.1.1_tmp_85/bin
For help, run: pnpm help add
ERROR  Command failed with exit code 1: pnpm add pnpm@9.1.1 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=/home/node/.local/share/pnpm/.tools/pnpm/9.1.1_tmp_74/bin
For help, run: pnpm help add
ERROR  Command failed with exit code 1: pnpm add pnpm@9.1.1 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=/home/node/.local/share/pnpm/.tools/pnpm/9.1.1_tmp_63/bin

If I delete the pnpm-workspace.yaml file, the error doesn't occur. If the project is in a folder other than the home folder, the error doesn't occur either. However, I have a situation where the project needs to be in the home folder.

Expected Behavior

I hope the update goes smoothly.

Which Node.js version are you using?

22.17.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Debian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions