#11351·pnpm

Phantom deps accessible via node_modules/.bin scripts

Author: abejfehrCreated Apr 23, 2026Updated Sep 26, 2026
Labelstype: bugpriority: 2

Verify latest release

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

pnpm version

10.33.0 (I couldn't test the more recent 10.33.2 because of a 5-day corporate cooldown policy)

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. check out https://github.com/abejfehr/pnpm-phantom-deps
  2. run pnpm install
  3. run pnpm repro:correct to observe that undici isn't importable normally
  4. run pnpm repro:incorrect to observe that undici is importable from a script in the .bin folder

Describe the Bug

Phantom deps that aren't explicitly defined in package.json are accessible via scripts in the .bin folder.

Expected Behavior

I would expect the same behaviour when running repro.js regardless of the env variables of whatever is executing it

Which Node.js version are you using?

v24.11.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)

No response