npm-codex-enotempty-repair
Skill4 starsChanged 6 months agoMITView on GitHub
Fix npm global install failures for @openai/codex when ENOTEMPTY rename conflicts occur in the global node_modules path.
- Deletes or force-pushes
- Installs packages
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dot_claude/CLAUDE.mdCLAUDE.md
- dot_claude_legacy/CLAUDE.mdCLAUDE.md
- cache-designSkill
- db-schema-designSkill
- go-new-moduleSkill
- go-perf-diagnoseSkill
- mq-designSkill
- rpc-designSkill
- system-design-docSkill
- middleware-opsSkill
- github-releaseSkill
- open-supports-installSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use this Skill when the user reports an error like:
- Distinctive: line 64
After running the repair, report:
- Distinctive: line 74
If reinstall still fails, capture and include the latest npm debug log path from output.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
npm Codex ENOTEMPTY Repair
Use this Skill when the user reports an error like:
npm ERR! code ENOTEMPTYrename .../@openai/codex -> .../@openai/.codex-*
Goal
Recover from stale temporary directories left by failed npm reify moves, then reinstall Codex CLI cleanly.
Procedure
Step 1: Resolve global prefix and inspect paths
npm prefix -g
npm root -gExpected affected paths:
<PREFIX>/lib/node_modules/@openai/codex<PREFIX>/lib/node_modules/@openai/.codex-*<PREFIX>/bin/codex<PREFIX>/bin/.codex-*
Step 2: Remove stale temp directories first
PREFIX="$(npm prefix -g)"
find "$PREFIX/lib/node_modules/@openai" -maxdepth 1 -type d -name '.codex-*' -exec rm -rf {} + 2>/dev/null || true
find "$PREFIX/bin" -maxdepth 1 -type f -name '.codex-*' -delete 2>/dev/null || trueStep 3: If uninstall fails, continue with hard cleanup
npm uninstall -g @openai/codex || true
PREFIX="$(npm prefix -g)"
rm -rf "$PREFIX/lib/node_modules/@openai/codex"
rm -f "$PREFIX/bin/codex"
find "$PREFIX/lib/node_modules/@openai" -maxdepth 1 -type d -name '.codex-*' -exec rm -rf {} + 2>/dev/null || true
find "$PREFIX/bin" -maxdepth 1 -type f -name '.codex-*' -delete 2>/dev/null || trueStep 4: Reinstall and verify
npm install -g @openai/codex@latest
command -v codex
codex --versionReporting Checklist
After running the repair, report:
- whether stale
.codex-*directories were found and removed; - whether uninstall failed or succeeded;
- whether reinstall succeeded;
- final
codex --versionoutput.
Notes
- This issue is usually local filesystem state, not a package version issue.
- If reinstall still fails, capture and include the latest npm debug log path from output.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

