Merge d984a5f572c4c2467f847ef7ca1eff5fb72eb7a6 into 5e417b44e1540f528d2ae63e3e20229a902d1db2
This commit is contained in:
commit
17967fa067
@ -1395,6 +1395,51 @@ ensure_default_node_active_shell() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Detect multiple Node.js environments and warn users
|
||||
# This helps prevent confusion when multiple openclaw installations exist
|
||||
warn_multiple_node_environments() {
|
||||
local envs_found=()
|
||||
local active_node=""
|
||||
active_node="$(command -v node 2>/dev/null || true)"
|
||||
|
||||
# Check for nvm (always count if installed, regardless of active node)
|
||||
if [[ -n "${NVM_DIR:-}" ]] || [[ -d "$HOME/.nvm" ]]; then
|
||||
envs_found+=("nvm (~/.nvm)")
|
||||
fi
|
||||
|
||||
# Check for fnm (always count if installed)
|
||||
if [[ -n "${FNM_DIR:-}" ]] || [[ -d "$HOME/.local/share/fnm" ]] || [[ -d "$HOME/.fnm" ]] || command -v fnm &>/dev/null; then
|
||||
envs_found+=("fnm")
|
||||
fi
|
||||
|
||||
# Check for volta (always count if installed)
|
||||
if [[ -n "${VOLTA_HOME:-}" ]] || [[ -d "$HOME/.volta" ]] || command -v volta &>/dev/null; then
|
||||
envs_found+=("volta (~/.volta)")
|
||||
fi
|
||||
|
||||
# Check for Homebrew node (macOS) - always count if exists
|
||||
if [[ -x "/opt/homebrew/bin/node" ]] || [[ -x "/usr/local/bin/node" ]]; then
|
||||
envs_found+=("homebrew")
|
||||
fi
|
||||
|
||||
# Check for system node - always count if exists
|
||||
if [[ -x "/usr/bin/node" ]]; then
|
||||
envs_found+=("system (/usr/bin/node)")
|
||||
fi
|
||||
|
||||
# Warn if multiple environments detected
|
||||
if [[ ${#envs_found[@]} -gt 1 ]]; then
|
||||
ui_warn "Multiple Node.js environments detected: ${envs_found[*]}"
|
||||
echo ""
|
||||
echo -e " ${INFO}This can cause confusion if openclaw is installed in different locations.${NC}"
|
||||
echo -e " ${INFO}Current active node: ${active_node:-none}${NC}"
|
||||
echo ""
|
||||
echo -e " ${MUTED}Recommendation: Use one Node version manager consistently.${NC}"
|
||||
echo -e " ${MUTED}After installing, verify with: which openclaw${NC}"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
check_node() {
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_VERSION="$(node_major_version || true)"
|
||||
@ -2336,6 +2381,9 @@ main() {
|
||||
|
||||
ui_stage "Preparing environment"
|
||||
|
||||
# Warn about multiple Node environments
|
||||
warn_multiple_node_environments
|
||||
|
||||
# Step 1: Homebrew (macOS only)
|
||||
install_homebrew
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user