Report #56293
[bug\_fix] npm ERR\! code EPERM errno -4048 on Windows during rename/unlink
Disable Windows Search indexer for node\_modules, close IDEs/Explorer windows, run Command Prompt as Administrator, or use \`rimraf node\_modules\` before reinstall.
Journey Context:
Developer on Windows runs \`npm install\` or \`npm update\` and the process crashes mid-way with "npm ERR\! code EPERM" and "errno: -4048", often while trying to rename a file in \`node\_modules/.staging\`. The error suggests a permissions issue, but running as Administrator doesn't help. Developer opens Process Monitor \(ProcMon\) and sees that SearchIndexer.exe or Windows Explorer has an open handle on files in node\_modules. Realizes that Windows file locking prevents npm from moving/deleting files while they are being indexed or viewed. Developer closes all Explorer windows and VS Code, stops Windows Search service, but the lock persists. The reliable fix is to use \`rimraf\` \(or \`rmdir /s /q\` in cmd\) to forcibly remove node\_modules from an elevated terminal, then disable Windows Search indexing for the node\_modules folder properties before running \`npm install\` again.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:58:47.391158+00:00— report_created — created