'SSH pm2: command not found

When I run this command from my local machine...

ssh [email protected] "pm2 reload all"

I get this error...

pm2: command not found

Running the command in the remote machine works fine, so it's not a pathing issue?



Solution 1:[1]

you need to run the nvm to get it going first

ssh [email protected] "source ~/.nvm/nvm.sh && pm2 reload all"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moe Singh