I want to remotely run a node.js script containing a shebang line through ssh
, similarly as when running it locally.
myscript
file:
#!/usr/bin/env node
var param = process.argv[2] || 'help';
//... other js code
When running locally on each host – e.g. myscript arg1
– it runs successfully. When running remotely on a "sister" node in a cluster (containing the same file and directory structure, including node
and myscript
):
ssh -o "PasswordAuthentication no" bob@123.1.2.3 /path/to/myscript arg1
I get /usr/bin/env: ‘node’: No such file or directory
error.
Am I missing a ssh
param / option?
Mode details: If I run
ssh -o "PasswordAuthentication no" bob@123.1.2.3 echo "hello"
It also works fine. Forgive me it this is obvious to you, I'm not an advanced Linux user, the ssh manual seemed a little bit overwhelming and tried a couple answers found here with no success: