title: installing node on jenkins 2.0 using the pipeline plugin
body: <p>I am running the following docker image <code>jenkinsci/jenkins:2.0-rc-1</code> to try out jenkins 2.0, and the "pipeline" view.</p>
  
  <p>I can't seem to install node. Here's my pipeline script:</p>
  
  <pre><code>node {
      //tool([name: 'node-5.10.1', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'])
      sh 'echo $(whoami)'
      sh 'node -v'
  }
  </code></pre>
  
  <p>The response when this runs is:</p>
  
  <pre><code>[ci] Running shell script
  + whoami
  + echo jenkins
  jenkins
  [Pipeline] sh
  [ci] Running shell script
  + node -v
  /../durable-3b0b1b07/script.sh: 2: /../durable-3b0b1b07/script.sh: node: not found
  </code></pre>
  
  <p>Here's what i've tried:</p>
  
  <ul>
  <li><p>the jenkins NodeJS tool (which works correctly when used with a freestyle job)</p></li>
  <li><p>logging into the docker container and installing node manually, for the same user:</p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/5QbkU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5QbkU.png" alt="enter image description here"></a></p>
  
  <p>UPDATE:</p>
  
  <p>Building on Jesse Glick's answer below, i added the result to my scripts <code>PATH</code>:</p>
  
  <pre><code>node { 
      def nodeHome = tool name: 'node-5.10.1', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
      env.PATH = "${nodeHome}/bin:${env.PATH}"
      sh 'npm install'
  }
  </code></pre>