Skip to content

Conversation

@keegancsmith
Copy link

Like EEXIST, we handle ENOTEMPTY when we fail to moveFile.

A user reported they consistently could not update our CLI tool. 1 In that report it always had the same file it tried to rename to. I believe what is happening here is when NPM retires an old version it renames it to a deterministic path. However, I suspect a previous update was interrupted leaving a non-empty directory at the destination.

When googling ENOTEMPTY all the results seem to be about npm failures with users suggesting clearing out node_modules. Maybe this will also solve those issues.

Like EEXIST, we handle ENOTEMPTY when we fail to moveFile.

A user reported they consistently could not update our CLI tool. [1] In
that report it always had the same file it tried to rename to. I believe
what is happening here is when NPM retires an old version it renames it
to a deterministic path. However, I suspect a previous update was
interrupted leaving a non-empty directory at the destination.

When googling ENOTEMPTY all the results seem to be about npm failures
with users suggesting clearing out node_modules. Maybe this will also
solve those issues.

[1]: https://gist.github.com/keegancsmith/5dac339583cc127031da6ed0e8512d47
@keegancsmith keegancsmith requested a review from a team as a code owner November 4, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant