Common causes
- Windows Defender or antivirus software has the file locked for scanning
- An IDE like VS Code has a file handle open on the file being deleted
- The file is read-only or in a read-only directory
- Another npm or node process is currently using the file
How to fix it
- Close your IDE, code editor, and any terminals using the project, then retry
- Add the project's node_modules directory to your antivirus exclusion list
- On Windows, try: rmdir /s /q node_modules and then npm install
- Restart your computer to release all file locks, then delete node_modules
Example
Error: EPERM: operation not permitted, unlink 'C:\Users\user\project\node_modules\.cache\file.js'Running npm install --force or deleting node_modules on Windows with antivirus active
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
