ETXTBSY occurs when npm attempts to modify or delete a file that is currently in use by another process. This is common in virtualized environments, shared folders, and VM setups.
Fixes ETXTBSY
npm cache clean --force
rm -rf node_modules package-lock.json
npm installnpm cache clean --forcerm -rf node_modules package-lock.jsonnpm installnpm ERR! code ETXTBSYnpm ERR! ETXTBSY: text file is busy
ETXTBSY is a system-level error that occurs when npm attempts to modify or delete a file that is currently in use by another process. The error stands for 'text file is busy' and typically happens during npm install when npm tries to rename, unlink, or modify files in your node_modules directory. This error is especially common in virtualized environments, shared file systems, and situations where file locking mechanisms prevent npm from making necessary changes to package files. VirtualBox/Vagrant shared folders are particularly prone to this issue.
Sometimes corrupted cache can cause file locking issues. Clear the npm cache completely and attempt a fresh install:
npm cache clean --force
rm -rf node_modules package-lock.json
npm installIf you're running npm inside a VirtualBox shared folder or VM, the --no-bin-links flag prevents npm from creating symbolic links:
npm install --no-bin-links
npm rebuild --no-bin-linksTo make this permanent, add it to your .npmrc file:
echo "bin-links=false" >> ~/.npmrcCreate the node_modules directory in the VM's home directory and link to it:
# Inside the VM
mkdir ~/node_modules
cd /vagrant/your-project
ln -sf ~/node_modules ./node_modules
npm installAlternatively, add this to your Vagrantfile to enable symlinks:
config.vm.provider "virtualbox" do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
endIf you're using Vagrant or VirtualBox, the most reliable solution is to run npm install directly from your Windows/Mac host:
# Exit vagrant SSH and run from your host OS
exit
npm installThis avoids the file system compatibility issues entirely.
If running on Windows or Mac natively, antivirus or file indexing services might be locking files:
Windows Defender:
# Disable Windows Defender temporarily
Set-MpPreference -DisableRealtimeMonitoring $true
npm install
# Re-enable after installation
Set-MpPreference -DisableRealtimeMonitoring $falseAlternatively, exclude your project folder from real-time scanning in antivirus settings.
If npm continues to fail, switch to yarn which has better handling of file locks:
# Install yarn globally
npm install -g yarn
# Remove npm artifacts
rm -rf node_modules package-lock.json
# Install using yarn
yarn installThe ETXTBSY error is fundamentally a file system permissions and symlink support issue. On Windows with VirtualBox/Vagrant, the problem occurs because Windows shares folders with Linux VMs without native symlink support, and npm tries to create symlinks in node_modules. Some Docker images on Apple Silicon Macs using Rosetta emulation have also reported this issue. For CI/CD pipelines, this error is rare because they run in proper Linux environments; if it occurs there, check that your Docker image is compatible with your host architecture.