title: bash doesn't load node on remote ssh command
body: <p>Excuse me if the subject is vague, but I tried to describe my problem to the best of my possibilities. I have my raspberry pi which I want to deploy to using codeship. Rsyncing the files works perfectly, but when I am to restart my application using <code>pm2</code> my problem occurs.</p>
  
  <p>I have installed node and pm2 using the node version manager NVM.</p>
  
  <pre><code>ssh pi@server.com 'source /home/pi/.bashrc; cd project; pm2 restart app.js -x -- --prod'0 min 3 sec
  bash: pm2: command not found
  </code></pre>
  
  <p>I have even added:</p>
  
  <p><code>shopt -s expand_aliases</code> in the bottom of my <code>bashrc</code> but it doesn't help.</p>
  
  <p>How can I make it restart my application after I have done a deploy? Thanks in advance for your sage advice and better wisdom!</p>
  
  <p><strong>EDIT 1</strong>: My .bashrc <a href="http://pastie.org/10529200">http://pastie.org/10529200</a>
  My $PATH: <code>/home/pi/.nvm/versions/node/v4.2.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games</code></p>
  
  <p><strong>EDIT 2</strong>: I added <code>/home/pi/.nvm/versions/node/v4.2.0/bin/pm2</code> which is the full path to pm2 and now I get the following error: <code>/usr/bin/env: node: No such file or directory</code></p>
  
  <p>It seems that even if I provide the full path, node isn't executed.</p>