Visitar URL original
PNPM errors with "the global target of the pnpm shim points back at the shim" on MacOS · Issue #16874 · pnpm/pnpm · GitHub
Skip to content

PNPM errors with "the global target of the pnpm shim points back at the shim" on MacOS #16874

Closed

Description

@liamdln

Verify latest release

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

pnpm version

12.11.2

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

No response

Reproduction steps

  1. Install pnpm on Mac (bug found with M4 pro).
  2. Run pnpm setup.

Running pnpm -v (or any pnpm command) now returns pnpm: the global target of the pnpm shim points back at the shim.

Describe the Bug

The bug stops PNPM from working. It just returns pnpm: the global target of the pnpm shim points back at the shim after each command.

I've managed to get it working again by running these two scripts:

rm -rf "$PNPM_HOME/global/v11/10d8-18ddd29b3747baa8-0"
rm -f "$PNPM_HOME/bin/.pnpm-shim-v1-pnpm-target" "$PNPM_HOME/bin/.pnpm-shim-v1-pn-target"

Expected Behavior

Running pnpm -v should return v12.11.2

Which Node.js version are you using?

v24.21.0

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)

No response

Contributing a fix

  • I am working on a fix

Activity

  1. added theissue type on Oct 12, 2026
  2. self-assigned this
    on Oct 12, 2026
  3. zkochan commented on Oct 12, 2026

    @zkochan
    Member

    Thanks for the report and the workaround. I reproduced this with 12.11.2. It happens when globalShims enables pnpm. pnpm setup then makes the pnpm shim and the bin of the globally installed pnpm package hard links of the same file, and the shim wrongly took that for a target pointing back at itself.

    #16880 fixes it, and it covers the whole issue. The shim now checks whether the target's path resolves to the shim's own path, so a hard link somewhere else runs normally. Until it's released, the workaround from the issue still works.


    Written by an agent (Claude Code, claude-opus-5-5).

  4. added a commit that references this issue on Oct 12, 2026
    62e1a80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions