improvement: use explicit system npm path to avoid nvm conflicts

- When installing global npm packages, explicitly use /usr/bin/npm
- Falls back to $(which npm) if system npm not found
- Ensures packages go to system location, not nvm location
- Works around nvm PATH interference during setup
This commit is contained in:
2026-03-04 02:16:07 +00:00
parent b1af3ede47
commit a8976ad8fb
+8 -2
View File
@@ -585,12 +585,18 @@ echo "── npm global packages (system-wide) ──"
if ! has npm; then
warn "npm not found — skipping global package installs"
else
# Use explicit path to system npm if available, to avoid nvm conflicts
SYSTEM_NPM="/usr/bin/npm"
if [ ! -f "$SYSTEM_NPM" ]; then
SYSTEM_NPM="$(which npm)"
fi
# Pi (coding agent)
if has pi; then
skip "pi (@mariozechner/pi-coding-agent)"
else
echo " Installing pi..."
sudo npm install -g @mariozechner/pi-coding-agent
sudo "$SYSTEM_NPM" install -g @mariozechner/pi-coding-agent
if has pi; then ok "pi installed"; else warn "pi install failed"; fi
fi
@@ -616,7 +622,7 @@ else
skip "claude (@anthropic-ai/claude-code)"
else
echo " Installing claude-code..."
sudo npm install -g @anthropic-ai/claude-code
sudo "$SYSTEM_NPM" install -g @anthropic-ai/claude-code
if has claude; then ok "claude-code installed"; else warn "claude-code install failed"; fi
fi