title: npm command not found pm2: command not found
body: <p>NVM node is installed under Ubuntu19.04 but local pm2 deploy production update will report errors such as pm2: command not found</p>
  
  <p>On the remote server</p>
  
  <pre><code>  root@vultr:/usr/bin# git --version
    git version 2.20.1
    root@vultr:/usr/bin# nvm --version
    0.34.0
    root@vultr:/usr/bin# node -v
    v10.15.3
    root@vultr:/usr/bin# npm -v
    6.4.1
  </code></pre>
  
  <p>On the local server</p>
  
  <pre><code>  pm2 deploy production update
  --&gt; Deploying to production environment
  --&gt; on host 202.182.98.13
    ○ deploying origin/master
    ○ executing pre-deploy-local
    ○ hook pre-deploy
    ○ fast forward master
  Already on 'master'
  Your branch is up to date with 'origin/master'.
  From github.com:zq0904/pm2
  Updating d79b633..2fe1d22
  Fast-forward
   README.md           | 3 ++-
   ecosystem.config.js | 2 +-
   2 files changed, 3 insertions(+), 2 deletions(-)
   * branch            master     -&gt; FETCH_HEAD
     d79b633..2fe1d22  master     -&gt; origin/master
    ○ executing post-deploy `git pull &amp;&amp; npm install &amp;&amp; pm2 reload ecosystem.config.js --env production`
  Already up to date.
  npm WARN 06-pm2@1.0.0 No repository field.
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
  
  up to date in 3.997s
  pm2: command not found
  
    post-deploy hook failed
  
  Deploy failed
  1
  </code></pre>
  
  <p>I can do it on a remote server</p>
  
  <pre><code>whereis npm
    lh -s /root/.nvm/versions/node/v10.15.3/bin/node /usr/bin/node
    lh -s /root/.nvm/versions/node/v10.15.3/bin/npm /usr/bin/npm
    lh -s /root/.nvm/versions/node/v10.15.3/bin/pm2 /usr/bin/pm2
  </code></pre>
  
  <p>That would solve the problem，
  But I don't understand why，
  The server can already output NPM node pm2 and other versions，
  But why do I have to set up a soft connection?
  Is there any good solution to this troublesome problem，
  Thank you very much！</p>