In a continuous deployment context I have a shell script executed to update and restart my app in the remote server
the script is:
ssh user@myserver <<'ENDSSH'
cd /opt/myapp
git pull
npm i
forever stop src
npm run staging
ENDSSH
the output is:
stdin: is not a tty
Already up-to-date.
-bash: line 3: npm: command not found
-bash: line 4: forever: command not found
-bash: line 5: npm: command not found
Note:
everything work if I ssh onto the remote server and enter those commands manually
node and npm are installed with nvm on the remote server
which npm
give /root/.nvm/versions/node/v6.10.0/bin/npm
I was facing same problem in jenkins.
Following lines was on bottom of .bashrc file , I just put top of .bashrc file
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With