Node.js child processes won't do if you need to use a password for login, because OpenSSH client does not read the password from stdin, but from a pseudo terminal.
You can work around this by using pty.js:
var pty = require("pty.js");
var term = pty.spawn("ssh", ["username@localhost", "whoami"]);
term.on("data", function(data) {
console.log("Incoming: " + data.toString());
});
// Wait a sec before sending the password. For proper implementation
// you should wait for the password prompt.
setTimeout(function(){
term.write("mypassword\n");
}, 1000);
This being said, you should always use SSH key pairs for this if possible.