Repository navigation
cmux-tui: document the npx ENOTEMPTY cache failure and hint the fix in the launcher #10886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,26 @@ npx cmux machine-agent --session agents | |
|
|
||
| Run this command from an interactive terminal with `/dev/tty`; the agent fails closed without a controlling terminal, including on reconnects. The first registration prints the one-time code used by `+ ssh host` on cmux.cloud. | ||
|
|
||
| ## Troubleshooting npx installs | ||
|
|
||
| `npx cmux@latest` can fail inside npm before cmux runs: | ||
|
|
||
| ```text | ||
| npm error code ENOTEMPTY | ||
| npm error syscall rename | ||
| npm error path ~/.npm/_npx/<hash>/node_modules/cmux-tui-darwin-arm64 | ||
| npm error ENOTEMPTY: directory not empty, rename ... | ||
| ``` | ||
|
|
||
| This is a long-standing npm bug in the `npx` package cache, not a cmux failure. It triggers when the cache holds an older cmux version and npm upgrades it in place, and it hits packages with per-platform binary dependencies (cmux ships `cmux-tui-<platform>` optional dependencies) most often. Clear the npx cache and rerun: | ||
|
|
||
| ```bash | ||
| rm -rf ~/.npm/_npx | ||
| npx cmux@latest | ||
|
Comment on lines
+124
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- scoped guidance ---'
find /tmp/coderabbit-repo-knowledge/manaflow-ai-cmux-b0f68d40 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- cmux-tui/AGENTS.md ---'
cat cmux-tui/AGENTS.md
printf '%s\n' '--- getting-started.md lines 110-135 ---'
cat -n cmux-tui/docs/getting-started.md | sed -n '110,135p'
printf '%s\n' '--- npm references in repository ---'
rg -n --glob '!node_modules' 'npm cache npx|_npx|npm config get cache|npx cmux' cmux-tui .github 2>/dev/null | head -80Repository: manaflow-ai/cmux Length of output: 14405 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- cmux-tui convention ---'
cat /tmp/coderabbit-repo-knowledge/manaflow-ai-cmux-b0f68d40/conventions/cmux-tui.md
printf '%s\n' '--- docs learning ---'
cat /tmp/coderabbit-repo-knowledge/manaflow-ai-cmux-b0f68d40/learnings/docs.mdRepository: manaflow-ai/cmux Length of output: 1570 🌐 Web query:
💡 Result: The npm cache and the npx cache are distinct, though the npx cache is typically located as a sub-directory named _npx within the configured npm cache directory [1][2][3]. Configurable Cache Location The location of the npm cache is determined by the cache configuration setting [4][2]. You can view the current path by running: npm config get cache [5][6] The default locations are: - Windows: %LocalAppData%\npm-cache [4][2] - Posix (Linux/macOS): ~/.npm [4][2] Managing the npx Cache While there is no single high-level command to automatically wipe the entire npx cache, you can manage it using the following methods: 1. npm cache npx commands The npm CLI provides limited commands to inspect and remove specific entries in the npx cache [1][2]: - npm cache npx ls: Lists the entries in the npx cache [1][2]. - npm cache npx rm [...]: Removes specific entries from the npx cache [1][2]. Note that this command requires the specific hex hash key (found via ls) rather than the package name [7]. - npm cache npx info ...: Provides details about a specific npx cache entry [1][2]. 2. Manual Removal Since the npx cache is stored in an opaque directory within the main npm cache (usually at _npx), it can be manually removed by deleting that directory [5][6]. - Windows: rm -rf %LocalAppData%\npm-cache_npx (or using PowerShell/File Explorer) [5][6] - Linux/macOS: rm -rf ~/.npm/_npx [5][6] Important Considerations - Self-Healing: The main npm cache is designed to be self-healing and resistant to corruption, so clearing it is generally only recommended to reclaim disk space [1][8]. - Distinction: Running npm cache clean --force clears the primary npm package cache but may not always remove the _npx sub-directory, depending on the npm version and environment [3]. - Persistence: The npx cache is not a reliable persistent data store; packages are cached solely to improve execution speed for subsequent runs [8][2]. If you encounter issues where npx is not using the latest version of a package, ensure you are using an appropriate version specifier (e.g., npx pkg@latest) rather than relying solely on cache clearing [3]. Citations:
Use npm’s configured cache directory. Line 125 hardcodes 🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| A global install avoids the npx cache entirely: `npm install -g cmux`, then run `cmux` and upgrade with `npm install -g cmux@latest`. | ||
|
|
||
| ## Sessions and sockets | ||
|
|
||
| The default socket path is: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: manaflow-ai/cmux
Length of output: 15619
🌐 Web query:
npm npx ENOTEMPTY rename _npx cache older package version optional dependencies known issue💡 Result:
The ENOTEMPTY error during npx execution typically indicates a failure within the npm cache, specifically when npm attempts to rename a directory during package installation or extraction [1][2]. This issue is commonly attributed to concurrent processes competing for the same cache directory or corruption due to interrupted installations [3][4][2][5]. ### Common Causes - Concurrent Execution: When multiple processes trigger npx for the same non-local package simultaneously, they may attempt to write to or modify the same cache directory, causing race conditions [3][4][5]. - Cache Corruption: Interrupted or failed installations can leave the npx cache in an inconsistent state, where directory renames fail because the target is not empty [2][6]. - Symlink Issues: If the user home directory is a symlink, npm's path resolution sometimes fails to correctly map the cache location, leading to errors during the reification step [7]. ### Recommended Solutions - Clear the Cache: The most effective immediate fix is to remove the corrupted npx cache directory. You can do this by running: rm -rf ~/.npm/_npx [2][6] Alternatively, use the built-in command: npm cache clean --force [2][6] - Isolate Processes: If you are running multiple processes in parallel (e.g., in CI/CD or scripts), ensure each process uses an isolated cache directory by setting the NPM_CONFIG_CACHE environment variable to a unique path for each task [4][5]. - Avoid Concurrent Calls: When possible, avoid running multiple npx commands that target the same package concurrently, as this creates direct competition for the shared cache folder [3][4]. - Consider Global Installation: If you encounter this issue repeatedly with a specific tool, installing it globally (npm install -g ) removes the need for npx to manage that package's cache, effectively bypassing the issue [2][6]. For further context, the npm maintainers have introduced lock mechanisms in newer CLI versions to mitigate some concurrency issues, though cache-related race conditions can still occur in complex environments [3].
Citations:
Qualify the npm diagnosis.
ENOTEMPTYcan result from concurrentnpxprocesses or interrupted cache updates, not only stale cache entries. State that stale cache entries are a common cause. If clearing~/.npm/_npxfails, tell users to check concurrent processes and retry with an isolatedNPM_CONFIG_CACHE.🤖 Prompt for AI Agents