israelroldan / grunt-ssh

SSH, SFTP tasks for Grunt.
https://npmjs.org/package/grunt-ssh
MIT License
245 stars 70 forks source link

Processes not found when using nvm #57

Open jvrousseau opened 10 years ago

jvrousseau commented 10 years ago

sshexec does not load bash profiles. So when using node through nvm (https://github.com/creationix/nvm), I get a process not found error. I have found a workaround, but it would be nice to see if someone has a more elegant solution.

Here is my current workaround: ~/.nvm/v0.10.12/bin/node ~/.nvm/v0.10.12/bin/forever start ~/application/deploy.js

andrewrjones commented 10 years ago

You're right, sshexec will not load bash profiles. It runs in the same way as if you use ssh with a command (ssh user1@server1 command1), which also does not load the bash profile.

ssh2, which does all the hard work, has another function called shell, which I think would load the bash profile. We need to create a task in this grunt plugin to use that function. This was also brought up in #24.

In the meantime, a workaround would be to have a script on your server than can source your bash profile and then run the commands you want, and execute that script using sshexec.