Skip to content

Commit 7401c3d

Browse files
committed
fix(claude): remove npm from all nvm versions during migration
1 parent 72d5516 commit 7401c3d

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

scripts/install_claude.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,27 @@ version_lt() {
172172
# Migrate from npm to native installer
173173
migrate_npm_to_native() {
174174
echo "[claude] Migrating from npm to native installer..." >&2
175-
echo "[claude] Removing npm package..." >&2
175+
echo "[claude] Removing npm packages..." >&2
176+
177+
# Remove from current npm
176178
npm uninstall -g @anthropic-ai/claude-code 2>/dev/null || true
179+
180+
# Remove from ALL nvm Node versions (they accumulate)
181+
if [ -d "$HOME/.nvm/versions/node" ]; then
182+
for node_dir in "$HOME/.nvm/versions/node"/*/; do
183+
if [ -d "$node_dir/lib/node_modules/@anthropic-ai" ]; then
184+
echo "[claude] Removing from ${node_dir}..." >&2
185+
rm -rf "$node_dir/lib/node_modules/@anthropic-ai"
186+
rm -f "$node_dir/bin/claude"
187+
fi
188+
done
189+
fi
190+
191+
# Remove pnpm version if present
192+
if command -v pnpm >/dev/null 2>&1; then
193+
pnpm uninstall -g @anthropic-ai/claude-code 2>/dev/null || true
194+
fi
195+
177196
hash -r 2>/dev/null || true
178197
echo "[claude] Installing native version..." >&2
179198
install_native

0 commit comments

Comments
 (0)