Skip to content
Back to skills

Npm Codex Enotempty Repair

BSecurity

Fix npm global install failures for @openai/codex when ENOTEMPTY rename conflicts occur in the global node_modules path.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 20, 2026
ai-agentsgonode

Works with

  • cli

Security analysis

B89/100
  • highPerforms destructive filesystem operations
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 20, 2026

npx -y skills add lamxy/agent-prompt-rules-system --skill npm-codex-enotempty-repair --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Npm Codex Enotempty Repair?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Npm Codex Enotempty Repair
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/lamxy-npm-codex-enotempty-repair/badge)](https://www.skillsdirectory.com/skills/lamxy-npm-codex-enotempty-repair)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: npm-codex-enotempty-repair
description: Fix npm global install failures for @openai/codex when ENOTEMPTY rename conflicts occur in the global node_modules path.
argument-hint: 'optional: explicit npm global prefix path'
---

# npm Codex ENOTEMPTY Repair

Use this Skill when the user reports an error like:

- `npm ERR! code ENOTEMPTY`
- `rename .../@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

```sh
npm prefix -g
npm root -g
```

Expected 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

```sh
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 || true
```

### Step 3: If uninstall fails, continue with hard cleanup

```sh
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 || true
```

### Step 4: Reinstall and verify

```sh
npm install -g @openai/codex@latest
command -v codex
codex --version
```

## Reporting Checklist

After running the repair, report:

- whether stale `.codex-*` directories were found and removed;
- whether uninstall failed or succeeded;
- whether reinstall succeeded;
- final `codex --version` output.

## 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.