ENOTEMPTY in Node.js — What It Means and How to Fix It
What the Node.js/npm error ENOTEMPTY means and how to resolve it.
Published October 26, 2026
ENOTEMPTY means an attempt to remove a directory failed because it still contains files.
Key points
- Use a recursive delete (like fs.rmSync with { recursive: true }) to remove a non-empty directory