Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions packages/ssh/src/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,12 @@ remote_node_satisfies_engine() {
NODE
}

remote_node_ready() {
command -v node >/dev/null 2>&1 && remote_node_satisfies_engine >/dev/null 2>&1
}

ensure_remote_node_path() {
if command -v node >/dev/null 2>&1 && remote_node_satisfies_engine >/dev/null 2>&1; then
if remote_node_ready; then
return 0
fi

Expand All @@ -363,7 +367,7 @@ ensure_remote_node_path() {

prepend_path_if_dir "$HOME/.local/share/mise/shims"
prepend_path_if_dir "$HOME/.mise/shims"
if ! command -v node >/dev/null 2>&1 && command -v mise >/dev/null 2>&1; then
if ! remote_node_ready && command -v mise >/dev/null 2>&1; then
eval "$(mise activate sh)" >/dev/null 2>&1 || true
fi

Expand All @@ -373,14 +377,14 @@ ensure_remote_node_path() {
export FNM_DIR
prepend_path_if_dir "$FNM_DIR"
prepend_path_if_dir "$HOME/.fnm"
if ! command -v node >/dev/null 2>&1 && command -v fnm >/dev/null 2>&1; then
if ! remote_node_ready && command -v fnm >/dev/null 2>&1; then
eval "$(fnm env --shell bash)" >/dev/null 2>&1 || true
fnm use --silent-if-unchanged >/dev/null 2>&1 || fnm use default >/dev/null 2>&1 || true
fi

prepend_path_if_dir "$HOME/.nodenv/bin"
prepend_path_if_dir "$HOME/.nodenv/shims"
if ! command -v node >/dev/null 2>&1 && command -v nodenv >/dev/null 2>&1; then
if ! remote_node_ready && command -v nodenv >/dev/null 2>&1; then
eval "$(nodenv init -)" >/dev/null 2>&1 || true
fi

Expand All @@ -392,21 +396,22 @@ ensure_remote_node_path() {
if [ -s "$NVM_DIR/nvm.sh" ]; then
# shellcheck disable=SC1090
. "$NVM_DIR/nvm.sh"
if ! command -v node >/dev/null 2>&1 && command -v nvm >/dev/null 2>&1; then
if ! remote_node_ready && command -v nvm >/dev/null 2>&1; then
nvm use --silent default >/dev/null 2>&1 || nvm use --silent node >/dev/null 2>&1 || nvm use --silent --lts >/dev/null 2>&1 || true
fi
fi

if ! command -v node >/dev/null 2>&1 && [ -d "$NVM_DIR/versions/node" ]; then
if ! remote_node_ready && [ -d "$NVM_DIR/versions/node" ]; then
for T3_NODE_BIN in "$NVM_DIR"/versions/node/*/bin; do
if [ -x "$T3_NODE_BIN/node" ]; then
PATH="$T3_NODE_BIN:$PATH"
export PATH
remote_node_ready && break
fi
done
fi

command -v node >/dev/null 2>&1 && remote_node_satisfies_engine
remote_node_ready

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium src/tunnel.ts:414

remote_node_ready redirects remote_node_satisfies_engine stderr to /dev/null, and ensure_remote_node_path returns via remote_node_ready at line 414. When no Node version satisfies the engine range, the Remote node <version> does not satisfy required range ... error from the engine check is suppressed, so the caller falls back to printing only the generic "missing node on PATH" message. This hides the specific version/range diagnostic needed to understand why remote startup failed. Consider having ensure_remote_node_path call remote_node_satisfies_engine without suppressing stderr on the final check, so the engine-range error surfaces to the caller.

Suggested change
remote_node_ready
command -v node >/dev/null 2>&1 && remote_node_satisfies_engine
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/ssh/src/tunnel.ts around line 414:

`remote_node_ready` redirects `remote_node_satisfies_engine` stderr to `/dev/null`, and `ensure_remote_node_path` returns via `remote_node_ready` at line 414. When no Node version satisfies the engine range, the `Remote node <version> does not satisfy required range ...` error from the engine check is suppressed, so the caller falls back to printing only the generic "missing node on PATH" message. This hides the specific version/range diagnostic needed to understand why remote startup failed. Consider having `ensure_remote_node_path` call `remote_node_satisfies_engine` without suppressing stderr on the final check, so the engine-range error surfaces to the caller.

}
`;

Expand Down
Loading