| I can also validate this issue. I have tested it on a fresh install of Jenkins 2.0 (v2.9 to be specific) with NodeJS v6.2.2. I have also done this for NodeJS 5.9, 6.0, 6.1, and 6.2.1. It appears that no version of NodeJS 6+ this works, but continues to work for versions <6.0. When the tool itself is installing modules, the PATH is not set correctly. When running the build job, the PATH gets set correctly, so node and npm are available and I can print out the versions.
Unpacking https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.gz to /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node-6.2.2 on Jenkins
$ /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node-6.2.2/bin/npm install -g mocha istanbul eslint grunt-cli forever mocha-junit-reporter
/usr/bin/env: node: No such file or directory
[testnode1] $ /bin/sh -xe /tmp/hudson4410243541713209879.sh
+ echo /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node-6.2.2/bin:/sbin:/usr/sbin:/bin:/usr/bin
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node-6.2.2/bin:/sbin:/usr/sbin:/bin:/usr/bin
+ npm -v
3.9.5
+ node -v
v6.2.2
|