The EBUSY error indicates that npm cannot access a file or directory because it's currently locked by another process, such as antivirus software, IDE file watchers, or cloud sync services. This is primarily a Windows-specific issue.
The EBUSY error indicates that npm cannot access a file or directory because it's currently locked or in use by another process. This is a Windows-specific issue that occurs during npm install, npm run, or other file operations when something (antivirus software, another terminal, IDE file watcher, or system process) has a lock on the node_modules directory or temporary files. Unlike other npm errors, EBUSY is an operating system-level constraint rather than a configuration issue. The file or folder npm needs to modify is being held open by another program, preventing the operation from completing. This error is almost exclusively a Windows issue because of how Windows file locking works compared to Unix-like systems. Windows uses exclusive file locks that prevent simultaneous access, while Linux/macOS use advisory locks that allow multiple readers.
The simplest solution is to close all open terminals, command prompts, and IDEs accessing your project.
Visual Studio Code:
Click the trash bin icon in the terminal tab to properly close it (clicking the X may keep it running in the background).
All terminals:
Close PowerShell, Command Prompt, Git Bash, and any other terminal windows.
Then try your npm command again:
npm installDelete the node_modules directory and package-lock.json, then clear the npm cache:
# Windows PowerShell
Remove-Item -Recurse -Force node_modules
Remove-Item package-lock.json
npm cache clean --force# Windows Command Prompt
rmdir /s node_modules
del package-lock.json
npm cache clean --forceAfter clearing everything, reinstall:
npm installAntivirus software like Windows Defender, AVG, Bullguard, or HP Wolf Security can lock files during scanning.
Windows Defender:
1. Open Windows Security (search in Start menu)
2. Click "Virus & threat protection"
3. Under "Virus & threat protection settings," click "Manage settings"
4. Toggle off "Real-time protection"
5. Run your npm command
6. Toggle real-time protection back on when done
If disabling antivirus fixes the issue, add your project folder to the antivirus exclusion/whitelist.
Cloud storage services like Dropbox, OneDrive, and Google Drive hold locks on files while syncing:
Pause synchronization:
- Dropbox: Click the icon in system tray → Pause syncing
- OneDrive: Click the icon in system tray → More → Pause syncing
- Google Drive: Stop Google Drive temporarily
Then try npm install:
npm installBetter solution: Move your project outside synced folders (e.g., to C:\Users\YourName\Projects instead of C:\Users\YourName\Dropbox\Projects).
Some background processes lock files in node_modules. Check Task Manager:
1. Press Ctrl+Shift+Esc to open Task Manager
2. Look for these common lock-holders:
- Java(TM) Platform SE Binary
- Electron processes
- Python processes
- Previous npm or node processes
3. Select each and click "End Task"
Or use PowerShell as Administrator:
# End all Node processes
Stop-Process -Name "node" -Force
# End all npm processes
Stop-Process -Name "npm" -ForceIf all else fails, run your terminal with elevated privileges and restart your system:
Run PowerShell as Administrator:
1. Press Windows key, search for "PowerShell"
2. Right-click the result and select "Run as administrator"
3. Navigate to your project directory:
cd "C:\Users\YourName\path\to\project"
npm installRestart your computer:
This clears all file locks held by processes:
Restart-ComputerAfter restarting, open a fresh terminal and try npm install again.
EBUSY is almost exclusively a Windows issue because of how Windows file locking works compared to Unix-like systems. Windows uses exclusive file locks that prevent simultaneous access, while Linux/macOS use advisory locks that allow multiple readers.
If you're using WSL2 (Windows Subsystem for Linux), ensure your project is inside the WSL filesystem (not a mounted Windows drive) to avoid Windows locking issues.
On NFS-mounted directories, EBUSY can occur due to how network file systems handle deleted open file handles.
Consider upgrading to Node.js 18+ and npm 8+, which have improved file locking handling. If issues persist, using a containerized environment (Docker) can completely isolate your build process from Windows file locking issues.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error