EPERM 🟩 Node.js

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

  1. Close editors/terminals using the folder and retry
  2. Exclude the project folder from antivirus real-time scanning
  3. Delete node_modules and reinstall

Detailed fix by platform

Windows

  1. rmdir /s /q node_modules && npm cache verify && npm install

How to diagnose

  1. Path — Which file?
  2. 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.