I have a very strange configuration issue.
When logging to machine (SSH session) and executing the following commands using interactive shell, they succeed:
node --version
npm --v
However, when I execute the following through script from remote machine:
#!/bin/bash
#Script input arguments
user=${1}
server=${2}
#Tell the shell to quote your variables to be eval-safe!
printf -v user_q '%q' "$user"
printf -v server_q '%q' "$server"
#
# Script variables
address="$user_q"@"$server_q"
#
function run {
ssh "$address" /bin/bash "$@"
}
run << SSHCONNECTION
node --version
npm --v
exit
SSHCONNECTION
I get the following output:
/bin/bash: line 2: node: command not found
/bin/bash: line 3: npm: command not found
I am conscious that the issue may be the in .bash_profile file configuration
export PATH="/usr/local/bin/npm:/usr/local/bin/node:/usr/local/bin:$PATH"
Also, here is result of npm config get prefix
:
/usr/local
Can you please suggest what I am doing wrong?