pi 설치 후 설치 위치를 못 찾아 문제 발생

This commit is contained in:
Jerry Chae committed 2026-05-13 16:24:33 +09:00
1 parent 2893ff3043
commit 392a42d2ef
1 file changed
+14 -1
+14 -1
View File
@@ -104,9 +104,11 @@ if command -v pi &>/dev/null; then
PI_BIN="$(command -v pi)"
fi
# 2) Try expanding common locations where npm/pip install globally
# 2) Try expanding common locations where npm/pip/curl-installer place the binary
# pi-node uses versioned dirs like node-v22.22.2-linux-x64, so we glob for any subdir
if [ -z "$PI_BIN" ]; then
for candidate in \
"$HOME/.local/share/pi-node/current/bin/pi" \
"$HOME/.local/bin/pi" \
"$HOME/.npm/bin/pi" \
"/usr/local/bin/pi" \
@@ -117,6 +119,17 @@ if [ -z "$PI_BIN" ]; then
break
fi
done
# Glob for pi-node versioned installs (e.g. ~/.local/share/pi-node/node-v22.22.2-linux-x64/bin/pi)
if [ -z "$PI_BIN" ]; then
_latest_pi_node="$HOME/.local/share/pi-node"
if [ -d "$_latest_pi_node" ]; then
_pi_node_bin="$(find "$_latest_pi_node" -name pi -path '*/bin/pi' -type f 2>/dev/null | head -1)"
if [ -n "$_pi_node_bin" ] && [ -x "$_pi_node_bin" ]; then
PI_BIN="$_pi_node_bin"
fi
fi
fi
fi
# 3) Try npm prefix to locate the global bin