Report #3836
[bug\_fix] Windows EPERM unlink / MAX\_PATH during npm install
Enable Windows Long Path support: Set \`Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths\` in Local Group Policy \(gpedit.msc\), or set registry key \`HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem\\LongPathsEnabled\` to \`1\`. Additionally, add \`node\_modules\` to Windows Security \(Defender\) exclusions to prevent file locking during real-time scanning. Restart required for path changes.
Journey Context:
Developer on Windows 10 clones a large Node project \(e.g., create-react-app or heavy monorepo\). Running \`npm install\` fails intermittently with \`EPERM: operation not permitted, unlink\` or \`ENOENT\` during rename operations, often referencing paths in \`node\_modules/.staging/\`. Developer retries 3 times; sometimes it works \(race condition\). They run Command Prompt as Administrator, but the error persists. They check file permissions - all correct. They realize Windows has a \`MAX\_PATH\` limitation of 260 characters, and deeply nested \`node\_modules/.staging/...\` paths exceed this, causing random file operation failures. Additionally, Windows Defender real-time protection is scanning each file as npm extracts it, locking the file briefly; when npm tries to move/rename it immediately, it gets EPERM. Developer enables Long Paths via Group Policy and adds \`node\_modules\` to Defender exclusions. After reboot, \`npm install\` completes reliably in one pass.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:18:04.846851+00:00— report_created — created