Skip to content

[Bug]: hermes gateway systemd unit omits nvm Node path and crash-loops with WhatsApp enabled #1766

Description

@sai-samarth

Bug description

When Hermes is installed on Linux with Node.js available only through nvm, hermes gateway install writes a systemd user unit whose PATH does not include the resolved Node binary directory. If WhatsApp is enabled, the gateway service enters a restart loop because the WhatsApp bridge requirement check cannot find node under the service environment.

Reproduction

Fresh repro on Ubuntu 24.04.3 LTS (WSL2), upstream main.

Environment

  • OS: Ubuntu 24.04.3 LTS
  • Hermes commit: 548cedb8694b198a67a521fb0186dd8dd5a449d3
  • Python: 3.12 system Python, installer created a 3.11 venv
  • Node install method: nvm
  • Node version: v24.14.0

Steps

  1. Install Node with nvm so node is available in an interactive shell but lives under ~/.nvm/.../bin/node.
  2. Install Hermes from upstream main.
  3. Add the following to ~/.hermes/.env:
    WHATSAPP_ENABLED=true
    WHATSAPP_MODE=bot
  4. Install the user gateway service:
    hermes gateway install
  5. Restart and inspect the service:
    systemctl --user restart hermes-gateway
    systemctl --user status hermes-gateway --no-pager
    journalctl --user -u hermes-gateway --no-pager -n 80
  6. Inspect the generated unit PATH / run the WhatsApp requirement check under the same environment.

Expected behavior

The generated systemd user unit should include the directory containing the currently-resolved node binary, so the WhatsApp bridge can start successfully when Node is installed via nvm.

Actual behavior

The generated unit contains a PATH like:

/home/<user>/.../venv/bin:/home/<user>/.../node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

which omits ~/.nvm/versions/node/.../bin.

As a result:

  • node is missing under the service environment
  • check_whatsapp_requirements() returns False
  • the gateway exits and systemd restart-loops it if WhatsApp is enabled

Minimal evidence

Generated unit PATH omitted the resolved Node directory.

Under the same service-like environment:

NODE_MISSING
CHECK_WHATSAPP_REQUIREMENTS False

Why this matters

This is a clean install failure path for WhatsApp on Linux systems where Node is installed through nvm, which is a common setup. The interactive shell works, but the background service does not.

Proposed fix

When generating the systemd unit, include dirname(shutil.which("node")) in the service PATH if node resolves during hermes gateway install.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions