Skip to content

Frustrating MacOS ENOTEMPTY rename issues on newer npm versions #1292

@bailey-coding

Description

@bailey-coding

Describe the bug

I think Heroku CLI maybe doesn't face this because of using an older version of node, though I haven't double-checked with the versions of NPM used with it.

Sometimes updating one of my plugins causes a frustrating edge case causing the update to file, and requires additional steps to clean it up and solve.

To Reproduce
Steps to reproduce the behaviour are a little challenging, but might be possible creating a new CLI that bundles a modern version of npm.

❯ mycli update
Fetching information about CLI update [channel: alpha] [dist-tag: alpha-darwin-arm64]... done
Restarting CLI to update plugins with the new version
Updating CLI from 16.0.20-alpha-darwin-arm64.0 to 16.0.21-alpha-darwin-arm64.0... done
Fetching information about CLI update [channel: alpha] [dist-tag: alpha-darwin-arm64]... already up-to-date (16.0.21-alpha-darwin-arm64.0)

Updating 5 installed plugin(s)...
 ›   Notice: Do not forget to refresh your completion cache by restarting your shell or by running
 ›
 ›       $ source ~/.zshrc
 ›       # OR
 ›       $ source <(mycli completion zsh)
 ›
 ›    More info for setting up completion on other shells can be found by running `mycli completion --help`
 ›
npm error code ENOTEMPTY
npm error syscall rename
npm error path /Users/myuser/.local/share/@myorganisation/mycli/node_modules/@myorganisation/myplugin
npm error dest /Users/myuser/.local/share/@myorganisation/mycli/node_modules/@myorganisation/.myplugin-6EHKOOFt
npm error errno -66
npm error ENOTEMPTY: directory not empty, rename '/Users/myuser/.local/share/@myorganisation/mycli/node_modules/@myorganisation/myplugin' -> '/Users/myuser/.local/share/@myorganisation/mycli/node_modules/@myorganisation/.myplugin-6EHKOOFt'
npm error A complete log of this run can be found in: /Users/myuser/.npm/_logs/2026-03-20T12_50_38_218Z-debug-0.log
@myorganisation/mycli: Updating plugins... !

Expected behaviour

Plugins to happily successfully update

Screenshots
N/A

Environment (please complete the following information):

  • OS & version: MacOS Tahoe 26.3.1
  • Shell/terminal & version zsh 6.9
  • Node: 24.11.1
  • NPM: 10.9.6

Additional context

Some long-lived related NPM issues:

npm/cli#5825
npm/cli#6370

Claude + Amp related issues from it

anthropics/claude-code#7373
https://ampcode.com/threads/T-1c48ef54-b8b8-4d8a-aa20-33b7c897f9fe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions