Here I'm trying to run node file in AWS server with the ssh command through the shell script, where inside the shell file there is a command to run node file (node test.js)
Executing the below command, will run the shell file inside AWS server
ssh -i sample-test.pem ubuntu@ip 'bash -s' < my-folder/test.sh
test.sh file [Shell file]
node test.jstest.js file [Node file]
console.log("Venkatesh");
If I run the shell command directly inside the AWS server, node file runs perfectly. But if I run with the ssh command, it throws an error like this:
line 1: node: command not found
I have also tried from nodejs by using node-ssh package, same error occurs again.
How do I suppose to run a node file through shell script from ssh command?