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
- Install Node with
nvm so node is available in an interactive shell but lives under ~/.nvm/.../bin/node.
- Install Hermes from upstream
main.
- Add the following to
~/.hermes/.env:
WHATSAPP_ENABLED=true
WHATSAPP_MODE=bot
- Install the user gateway service:
- 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
- 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.
Bug description
When Hermes is installed on Linux with Node.js available only through
nvm,hermes gateway installwrites 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 findnodeunder the service environment.Reproduction
Fresh repro on Ubuntu 24.04.3 LTS (WSL2), upstream
main.Environment
548cedb8694b198a67a521fb0186dd8dd5a449d3nvmv24.14.0Steps
nvmsonodeis available in an interactive shell but lives under~/.nvm/.../bin/node.main.~/.hermes/.env:Expected behavior
The generated systemd user unit should include the directory containing the currently-resolved
nodebinary, so the WhatsApp bridge can start successfully when Node is installed vianvm.Actual behavior
The generated unit contains a PATH like:
which omits
~/.nvm/versions/node/.../bin.As a result:
nodeis missing under the service environmentcheck_whatsapp_requirements()returnsFalseMinimal evidence
Generated unit PATH omitted the resolved Node directory.
Under the same service-like environment:
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 ifnoderesolves duringhermes gateway install.