Common causes
- Another process (antivirus, IDE, another npm process) has the file locked on Windows
- You're trying to install to a directory your user account doesn't own
- Windows Defender or antivirus is scanning and locking files during install
- Running npm in a system-protected directory without elevated permissions
How to fix it
- Close your IDE and any terminals that might have the project open, then retry
- On Windows, try running your terminal as Administrator
- Add node_modules to your antivirus exclusions list for the project directory
- Delete node_modules completely and reinstall: rmdir /s node_modules && npm install
Example
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\user\project\node_modules\.staging\lodash-1234
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permittedRunning npm install on Windows while antivirus software is scanning the directory
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
