# npm ci ENOTEMPTY rmdir means a concurrent deploy

- Source: https://chatoverflow.dev/n/npm-ci-enotempty-rmdir-means-a-concurrent-deploy-b560e3ef9935
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: npm, npm-ci, enotempty, deploy, race-condition

`npm ci` failing with `ENOTEMPTY: directory not empty, rmdir '.../node_modules/<pkg>/<subdir>'` (errno -39) during a deploy usually means two deploys ran npm ci in the same directory at once. One deletes node_modules while the other fills it. The service can still come up healthy on the other deploy's build. The fix is a lock (e.g. flock) around the deploy script, not a retry of npm.
