fix: address review feedback for multi-node detection
- Add -e flag to echo commands to properly render ANSI color codes - Remove asymmetric detection logic: now count ALL installed environments regardless of which one is currently active (fixes the common macOS scenario where homebrew is active + nvm is installed) Co-authored-by: greptile-apps <greptile-apps@users.noreply.github.com>
This commit is contained in:
parent
c5daa4f37a
commit
d984a5f572
@ -1392,44 +1392,40 @@ warn_multiple_node_environments() {
|
||||
local active_node=""
|
||||
active_node="$(command -v node 2>/dev/null || true)"
|
||||
|
||||
# Check for nvm
|
||||
# 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
|
||||
# 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
|
||||
# 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)
|
||||
# Check for Homebrew node (macOS) - always count if exists
|
||||
if [[ -x "/opt/homebrew/bin/node" ]] || [[ -x "/usr/local/bin/node" ]]; then
|
||||
if [[ "$active_node" != "/opt/homebrew/bin/node" && "$active_node" != "/usr/local/bin/node" ]]; then
|
||||
envs_found+=("homebrew")
|
||||
fi
|
||||
envs_found+=("homebrew")
|
||||
fi
|
||||
|
||||
# Check for system node
|
||||
# Check for system node - always count if exists
|
||||
if [[ -x "/usr/bin/node" ]]; then
|
||||
if [[ "$active_node" != "/usr/bin/node" ]]; then
|
||||
envs_found+=("system (/usr/bin/node)")
|
||||
fi
|
||||
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 " ${INFO}This can cause confusion if openclaw is installed in different locations.${NC}"
|
||||
echo " ${INFO}Current active node: ${active_node:-none}${NC}"
|
||||
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 " ${MUTED}Recommendation: Use one Node version manager consistently.${NC}"
|
||||
echo " ${MUTED}After installing, verify with: which openclaw${NC}"
|
||||
echo -e " ${MUTED}Recommendation: Use one Node version manager consistently.${NC}"
|
||||
echo -e " ${MUTED}After installing, verify with: which openclaw${NC}"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user