title: Jenkins shell not working when nvm is deployed on deployment server
body: <p>I am trying to setup a deployment from jenkins which is sitting on say, server A (ec2 machine) to server b (ec2 machine).  I added a shell script to a script in the code being pulled from the
  repository.  Jenkins is able to connect to server b via ssh and this works.  The issue seems to be when it gets to the line for npm as I keep getting the following error in the jenkins console output
  along with a failure notification for the job.</p>
  <pre><code>Error Messages
  -bash: line X: npm: command not found
  -bash: line Y: npm: command not found
  </code></pre>
  <p>Here is an example of what is in the script file</p>
  <pre><code>#!/bin/sh
  ssh ubuntu@111.222.333.444 -i /var/lib/jenkins/.ssh/id_rsa -v &lt;&lt;EOF
    cd ~/folder_to_deploy_into
    git pull origin master
    npm install
    npm run pm2
    exit
  EOF
  </code></pre>
  <p>I am running nvm on the server and I have nodejs plugin installed for jenkins, but I can ssh into the machine and run nvm, npm, etc. and they all work.  If Jenkins is accessing the other machine via ssh and then executing the nesecessary
  commands to start the application, how can I make the script aware of the PATH as the commands seem to work if I directly ssh into the machine and issue the commands?</p>