Common causes
- A previous npm install was interrupted and left partial files behind
- A file or directory inside node_modules is locked by another process on Windows
- Concurrent npm installs running at the same time
- npm is trying to clean up a staging directory that still has contents
How to fix it
- Delete node_modules entirely and reinstall: rm -rf node_modules && npm install
- On Windows: rmdir /s /q node_modules && npm install
- Clear the npm cache: npm cache clean --force
- Close all editors and terminals, then delete node_modules and reinstall
Example
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /home/user/project/node_modules/lodash
npm ERR! dest /home/user/project/node_modules/.lodash-old
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not emptyRunning npm install when a previous interrupted install left partial files in node_modules
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
