Skip to content

Remote provisioning fails on fresh hosts without Node (bootstrap exits 2 in nodePathPrelude) #20

Closed

Description

@Solaris136

Plugin version

0.8.18

DSH version

Local: 0.2.2-rc.1 (DSH Desktop, Windows 11). Remote: fresh Ubuntu 24.04, no Node installed.

Area

Remote provisioning

Reproduction steps

  1. Install dsh-remote-local-plugin@0.8.18 (desktop profile) and restart.
  2. Add an SSH host that has no Node.js installed (the auto-install-Node path).
  3. Let auto-connect run provisioning. The agent tarball is uploaded and ~/.local/share/dsh-remote / ~/.dsh/remote-agent are created, then provisioning fails and retries with:
远端自动安装失败:remote bootstrap exited with 2

Expected behavior

Bootstrap detects the missing Node and installs the configured remoteNodeVersion (22.19.0 by default), then continues.

Relevant logs

Root cause appears to be nodePathPrelude() in the generated bootstrap script. It runs under set -euo pipefail and contains:

NODE_BIN_DIR="$(ls -d "$HOME"/.nvm/versions/node/*/bin 2>/dev/null | sort -V | tail -1)"

On a host without nvm, the glob does not match, ls exits 2, and pipefail makes the whole script exit 2 before the Node-install step. Reproduced standalone by running the prelude on the remote host: PRELUDE_EXIT=2.

Workaround: install Node 22.19.0 on the remote host first; provisioning then completes in ~30s.

Possible fix: append || true to the ls ... | sort -V | tail -1 pipeline (or guard with compgen -G before listing).

(No tokens/keys/hostnames included.)

Activity

  1. Golden-Pigeon commented on Nov 9, 2026

    @Golden-Pigeon
    Owner

    Fixed in #24.

    The bootstrap now treats the nvm probe as best-effort, so a host without nvm no longer aborts before the Node auto-install step runs. Added a regression test that executes the generated prelude with no nvm and no node.

    Verified with an isolated Ubuntu 24.04 container with no Node/nvm: the fixed installer uploaded the agent and ran the full bootstrap; Node 22.19.0 was auto-installed, DSH 0.2.2-rc.1 and the remote agent were installed, dsh web started, and the agent reached ready state.

    Thanks @Solaris136 for the detailed report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions