Title: `npm` not found during Claude Code / Codex install — fnm not activated in piped execution scope
Labels: bug, windows
## Problem
When running the bootstrap via `irm ... | iex`, the script fails at the Claude Code section with:
iex : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program.
## Root Cause
The Node section correctly calls `fnm env --use-on-cd | Out-String | Invoke-Expression` to activate fnm, but when the script is executed via `iex` (piped), the Claude Code and Codex sections run in a child scope where fnm activation does not persist. By the time the script reaches `npm install -g @anthropic-ai/claude-code`, `npm` is not on PATH.
## Steps to Reproduce
1. Run `irm https://raw.githubusercontent.com/AojdevStudio/dev-bootstrap/main/bootstrap.ps1 | iex` on a fresh Windows machine
2. Watch Node, Python, and Bun install successfully
3. Script fails at `== Claude Code ==` with `npm not recognized`
## Fix
Add an fnm re-activation guard before each `npm install` call in the Claude Code and Codex sections:
```powershell
if (Get-Command fnm -ErrorAction SilentlyContinue) {
fnm env --use-on-cd | Out-String | Invoke-Expression
}
Apply immediately before:
npm install -g @anthropic-ai/claude-code
npm install -g @openai/codex
Workaround
Run these manually after the bootstrap fails:
fnm env --use-on-cd | Out-String | Invoke-Expression
npm install -g @anthropic-ai/claude-code
npm install -g @openai/codex
Environment
- Windows 11
- PowerShell 5.1
- fnm installed via winget
# ---- Claude Code ----
# Re-activate fnm so npm is available in this scope
if (Get-Command fnm -ErrorAction SilentlyContinue) {
fnm env --use-on-cd | Out-String | Invoke-Expression
}
# npm avoids Zscaler/corporate-proxy blocks on irm|iex pattern
npm install -g @anthropic-ai/claude-code
RefreshPath
Need "claude" "If this is your first run, open a new PowerShell window and rerun so PATH updates apply."
claude --version 2>$null | Out-Host
# ---- Codex CLI ----
# Re-activate fnm so npm is available in this scope
if (Get-Command fnm -ErrorAction SilentlyContinue) {
fnm env --use-on-cd | Out-String | Invoke-Expression
}
# Official Codex CLI docs: https://developers.openai.com/codex/cli
npm install -g @openai/codex
RefreshPath
Need "codex" "If this is your first run, open a new PowerShell window and rerun so PATH updates apply."
codex --version 2>$null | Out-Host
iex : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program.
Apply immediately before:
npm install -g @anthropic-ai/claude-codenpm install -g @openai/codexWorkaround
Run these manually after the bootstrap fails:
Environment