fix(install): install Claude Code via official native installer, not npm
Uniformizes point 1: install.sh fresh-machine branch used npm, but npm is no longer a documented Claude Code channel (official quickstart lists Native/Homebrew/WinGet/apt only) and collides with the native symlink. Switch the fresh-install path to the recommended native installer, matching install-plugins.sh which already points to the native channel. - install.sh: fresh install via `curl -fsSL https://claude.ai/install.sh | bash`; ensure ~/.local/bin on PATH for the auth/verify steps. - skip-if-present guard unchanged. - fix stale node/npm prerequisite comment (npm now serves the plugins step, not the Claude Code install). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
01f9ebb57b
commit
6be627e246
20
install.sh
20
install.sh
@ -22,8 +22,9 @@ echo ""
|
|||||||
# ── 1. Check prerequisites ──
|
# ── 1. Check prerequisites ──
|
||||||
echo "── Checking prerequisites..."
|
echo "── Checking prerequisites..."
|
||||||
|
|
||||||
# node + npm drive the Claude Code CLI install below. On a fresh machine
|
# node + npm are needed by the plugins step (install-plugins.sh: gsd-pi et al.);
|
||||||
# they may be absent — install the current LTS via nvm instead of aborting.
|
# Claude Code itself now installs via its own native installer below. On a fresh
|
||||||
|
# machine node/npm may be absent — install the current LTS via nvm, not abort.
|
||||||
install_node_via_nvm() {
|
install_node_via_nvm() {
|
||||||
info "Node.js/npm missing — installing LTS via nvm..."
|
info "Node.js/npm missing — installing LTS via nvm..."
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||||
@ -56,13 +57,18 @@ ok "npm $(npm -v)"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "── Installing Claude Code..."
|
echo "── Installing Claude Code..."
|
||||||
|
|
||||||
# Idempotent: an existing claude (native installer under ~/.local/share/claude,
|
# Idempotent + official channel. Skip if already present (mirrors the RTK/GSD
|
||||||
# or any prior install) already owns ~/.local/bin/claude — npm cannot clobber a
|
# guard) — the binary is a native-installer symlink at ~/.local/bin/claude that
|
||||||
# symlink it does not manage (EEXIST). Mirror the RTK/GSD skip-if-present guard;
|
# self-updates. On a fresh machine install via the official native installer
|
||||||
# upgrades are `make update`'s job (update-all.sh), not first-time install.
|
# (code.claude.com/docs quickstart), NOT npm: npm is no longer a documented
|
||||||
|
# channel, would collide with the native symlink (EEXIST), and bypasses the
|
||||||
|
# built-in auto-update. Upgrades are `make update`'s job, not first-time install.
|
||||||
if command -v claude &>/dev/null; then
|
if command -v claude &>/dev/null; then
|
||||||
ok "Claude Code already installed ($(claude --version 2>/dev/null | head -1))"
|
ok "Claude Code already installed ($(claude --version 2>/dev/null | head -1))"
|
||||||
elif npm install -g @anthropic-ai/claude-code@latest; then
|
elif curl -fsSL https://claude.ai/install.sh | bash; then
|
||||||
|
# Native installer targets ~/.local/bin — put it on PATH for the auth +
|
||||||
|
# verification steps that follow in this same (non-login) shell.
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
ok "Claude Code installed: $(claude --version 2>/dev/null || echo 'unknown')"
|
ok "Claude Code installed: $(claude --version 2>/dev/null || echo 'unknown')"
|
||||||
else
|
else
|
||||||
err "Claude Code installation failed"
|
err "Claude Code installation failed"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user