You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pnpm node_modules NTFS junctions cause catastrophic data loss when directories are deleted with Remove-Item -Recurse -Force or rm -rf on Windows — real-world incident report #10707
PowerShell/MSYS follows the NTFS junctions inside node_modules → deletes REAL target directories outside the worktree
Catastrophic data loss — Windows user profile folders, source code, other projects permanently deleted. Recycle Bin bypassed.e -Force ./variant-a`
OR using Git Bash/MSYS: rm -rf ./variant-a
PowerShell/MSYS follows the NTFS junctions inside node_modules → deletes REAL target directories
Catastrophic deletion outside the target directory — user profile folders, other projects, etc.
Describe the Bug
Real-world incident — February 26, 2026. Two users lost their entire Windows user profiles on the same day.
pnpm uses NTFS junctions (directory reparse points) on Windows to link packages in node_modules to the global store and between workspaces. This is by design for performance, but creates a catastrophic danger: standard recursive deletion commands (Remove-Item -Recurse -Force in PowerShell, rm -rf in Git Bash/MSYS) follow these junctions into their real targets and delete files outside the intended directory.
Actual data lost (my incident):
C:\Users\wilbe\Documents\, Downloads\, Music\, Pictures\, Videos\, Favorites\ — ALL PERMANENTLY DELETED
This was triggered by Claude Code CLI, which executed Remove-Item -Recurse -Force on git worktrees without knowing about this danger.
Known PowerShell bugs:PowerShell/PowerShell#16664, #19714 (both OPEN), git-for-windows/git#607
Deleting a pnpm worktree directory should only delete files within that directory. Junction points in node_modules should be removed as links, NOT followed into their real target directories. The behavior should be identical to cmd.exe /c "rmdir /S /Q <path>" which correctly handles this. Request for pnpm:
Add a prominent WARNING in Windows documentation about this danger
Deleting a directory containing pnpm node_modules should ONLY delete files within that directory. NTFS junction points should be removed as links (the junction itself), NOT followed into their real target directories. Safe method: cmd.exe /c "rmdir /S /Q <path>"
Which Node.js version are you using?
20.x (exact version not recorded at time of incident)
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)
Verify latest 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
No response
Reproduction steps
git worktree add ./variant-a+git worktree add ./variant-bpnpm installinside the worktrees — pnpm creates NTFS junctions innode_modulespointing to the main repo packages and global pnpm storegit worktree add ./variant-a+git worktree add ./variant-bpnpm installinside the worktrees — pnpm creates NTFS junctions innode_modulespointing to the main repo packages and the global pnpm storeRemove-Item -Recurse -Force ./variant-arm -rf ./variant-anode_modules→ deletes REAL target directories outside the worktreerm -rf ./variant-anode_modules→ deletes REAL target directoriesDescribe the Bug
Real-world incident — February 26, 2026. Two users lost their entire Windows user profiles on the same day.
pnpm uses NTFS junctions (directory reparse points) on Windows to link packages in
node_modulesto the global store and between workspaces. This is by design for performance, but creates a catastrophic danger: standard recursive deletion commands (Remove-Item -Recurse -Forcein PowerShell,rm -rfin Git Bash/MSYS) follow these junctions into their real targets and delete files outside the intended directory.Actual data lost (my incident):
C:\Users\wilbe\Documents\,Downloads\,Music\,Pictures\,Videos\,Favorites\— ALL PERMANENTLY DELETEDSecond victim same day: [BUG] Claude Code v2.1.58 deleted entire Windows user profile (C:\Users\msafa) - CRITICAL DATA LOSS anthropics/claude-code#29023 — user msafakaraca lost their entire
C:\Users\msafa\profile including a production SaaS application serving 50+ tax clients.This was triggered by Claude Code CLI, which executed
Remove-Item -Recurse -Forceon git worktrees without knowing about this danger.Known PowerShell bugs: PowerShell/PowerShell#16664, #19714 (both OPEN), git-for-windows/git#607
Deleting a pnpm worktree directory should only delete files within that directory. Junction points in
node_modulesshould be removed as links, NOT followed into their real target directories. The behavior should be identical tocmd.exe /c "rmdir /S /Q <path>"which correctly handles this.Request for pnpm:
cmd.exe /c "rmdir /S /Q <path>"pnpm worktree removeorpnpm cleancommand that safely removes node_modules on WindowsRelated issues: Remove-Item -Recurse -Force follows NTFS junctions in node_modules (pnpm), deleting real files outside the target directory — catastrophic data loss PowerShell/PowerShell#26913, [MODEL] Claude Code CLI executed Remove-Item -Recurse -Force on pnpm worktrees, triggering catastrophic NTFS junction traversal — permanent deletion of user profile folders and source code anthropics/claude-code#29249, #29023, #29082
Expected Behavior
Deleting a directory containing pnpm
node_modulesshould ONLY delete files within that directory. NTFS junction points should be removed as links (the junction itself), NOT followed into their real target directories. Safe method:cmd.exe /c "rmdir /S /Q <path>"Which Node.js version are you using?
20.x (exact version not recorded at time of incident)
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response