Using node ssh2 prompts an error: sudo: sorry, you must have a tty to run sudo
Solution:
vi /etc/sudoers
comment out the Defaults requiretty line
#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
# You have to run "ssh -t hostname sudo <cmd>".
#
Defaults requiretty