Error: EPERM: operation not permitted, rename / unlink
The OS refused a file operation — on Windows usually because another process (antivirus, editor, indexer) has the file locked.
Seen on:
Node.js
Meaning
EPERM differs from EACCES: permissions might be fine, but the operation isn’t allowed right now. npm on Windows hits it when antivirus scans node_modules.
Common causes
- File locked by antivirus, IDE or another Node process (Windows)
- Read-only files/folders
- Running as a user without rights on a system folder
⚡ Quick fix
- Close editors/terminals using the folder and retry
- Exclude the project folder from antivirus real-time scanning
- Delete node_modules and reinstall
Detailed fix by platform
Windows
rmdir /s /q node_modules && npm cache verify && npm install
How to diagnose
- Path — Which file?
- Lock — Is another program using it?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026