Hello,
I’m trying to automate the deployment of a Node.js/Next.js project on my aaPanel VPS using GitHub Actions and the appleboy/ssh-action.
Node.js (v22.17.0), npm, and pm2 are installed via aaPanel.
All binaries are in /www/server/nodejs/v22.17.0/bin/ and are executable.
In an interactive SSH session (ssh user@server), I can run node -v, npm -v, and pm2 -v without any issue after setting export PATH=/www/server/nodejs/v22.17.0/bin:$PATH.
The symlinks and permissions are correct, and the underlying scripts (like npm-cli.js) are executable.
Problem:
When my GitHub Actions workflow connects via SSH (non-interactive session), I always get:
npm: command not found
pm2: command not found
even if I add export PATH=/www/server/nodejs/v22.17.0/bin:$PATH at the start of the script.
What I tried:
Using the absolute paths for node, npm, and pm2 in the script.
Symlinking node to /usr/bin/node.
Ensuring all scripts and symlinks are executable (chmod +x ...).
Printing $PATH and ls -l in the workflow, which shows the binaries are present.
My shell is
bash
and the user is in the correct group.
Everything works in interactive SSH, but never in the GitHub Actions SSH session.
Question:
Is there something about aaPanel’s Node.js/npm/pm2 installation that prevents them from being found/executed in non-interactive SSH sessions?
How can I make npm and pm2 reliably available for automation (CI/CD, remote scripts, etc.)?
Any advice or aaPanel-specific configuration tips would be greatly appreciated!
Thank you!
