title: Azure DevOps private agent - how to install node using nvm
body: <p>I am trying to setup a private build agent for Azure DevOps on Ubuntu. And I need to use npm task for builds.</p>
  
  <p>I tried to use nvm to install the latest node, and the installation was successful:</p>
  
  <pre><code>curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
  nvm install 11.10.1
  </code></pre>
  
  <p>I can check <code>node -v</code> and <code>npm -v</code>. But when the npm task is executed from the pipeline - it fails with </p>
  
  <blockquote>
    <p>Unable to locate executable file: 'npm'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.</p>
  </blockquote>
  
  <p>In my PATH I have <code>/usr/local/nvm/versions/node/v11.10.1/bin</code> and <code>ls -l</code> shows:</p>
  
  <blockquote>
    <p>lrwxrwxrwx 1 500 500 38 Feb 28 06:00 /usr/local/nvm/versions/node/v11.10.1/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js</p>
  </blockquote>
  
  <p>I also added 777 (just to try it!) for npm-cli.js, and still no luck.</p>
  
  <p>I also found this similar question - <a href="https://github.com/Microsoft/azure-pipelines-agent/issues/1862" rel="nofollow noreferrer">https://github.com/Microsoft/azure-pipelines-agent/issues/1862</a></p>
  
  <p>How to properly install node and npm using nvm on Ubuntu agent for Azure DevOps?</p>