fix: lower Node.js requirement to v18, update repo before running updater

- Changed MIN_NODE_VERSION from (24, 13, 0) to (18, 0, 0) to match Claude Code requirements
- Updated uclaude_install.sh to fetch latest repo before running updater
- Rewrote uclaude_update.ps1 to require v18+ and update repo first
- Added multiple fallback methods for Node.js installation on Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-02-26 18:18:48 +00:00
parent daab4f8320
commit ae06a26974
3 changed files with 141 additions and 40 deletions

View File

@@ -80,7 +80,7 @@ def run_cmd(cmd, **kwargs):
# Node.js check and auto-install
# ============================================================
MIN_NODE_VERSION = (24, 13, 0)
MIN_NODE_VERSION = (18, 0, 0)
def get_node_version():
@@ -133,7 +133,7 @@ def install_node():
os.remove(old_list)
result = run_cmd(
["bash", "-c", "curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt-get install -y nodejs"],
["bash", "-c", "curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt-get remove -y nodejs || true && apt-get install -y nodejs"],
timeout=180, capture_output=True, text=True,
)
if result.returncode == 0:
@@ -176,7 +176,15 @@ def ensure_node():
if ver is None:
print(f" {Y}Node.js not found.{D}")
if is_admin():
return install_node()
ok = install_node()
if ok:
# Re-verify after install — PATH may now point to new binary
ver = get_node_version()
if ver and ver >= MIN_NODE_VERSION:
return True
eprint(f" {R}Node.js still not available after install. Reopen shell or check PATH.{D}")
return False
return False
else:
eprint(f" {R}Install Node.js v{'.'.join(map(str, MIN_NODE_VERSION))}+: https://nodejs.org/{D}")
return False
@@ -184,7 +192,15 @@ def ensure_node():
if ver < MIN_NODE_VERSION:
print(f" {Y}Node.js v{'.'.join(map(str, ver))} found, need v{'.'.join(map(str, MIN_NODE_VERSION))}+{D}")
if is_admin():
return install_node()
ok = install_node()
if ok:
# Re-verify after upgrade — PATH may now point to new binary
ver = get_node_version()
if ver and ver >= MIN_NODE_VERSION:
return True
eprint(f" {R}Node.js version still insufficient after upgrade. Reopen shell or check PATH.{D}")
return False
return False
else:
eprint(f" {R}Update Node.js: https://nodejs.org/{D}")
return False
@@ -265,6 +281,15 @@ def find_cli_js():
"/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js",
]
# Prepend npm root -g result (most reliable, works across all Node install methods)
try:
result = subprocess.run(["npm", "root", "-g"], capture_output=True, text=True, timeout=10)
if result.returncode == 0:
npm_global = result.stdout.strip()
candidates.insert(0, os.path.join(npm_global, "@anthropic-ai", "claude-code", "cli.js"))
except Exception:
pass
for path in candidates:
if os.path.isfile(path):
return path