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
- check out https://github.com/abejfehr/pnpm-phantom-deps
- run
pnpm install - run
pnpm repro:correctto observe thatundiciisn't importable normally - run
pnpm repro:incorrectto observe thatundiciis importable from a script in the.binfolder
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
Source: pnpm/pnpm