Running NPM on a self-hosted VSO Agent
The solution to this was to install node.js with the regular installer :
https://nodejs.org/en/download/
This then worked. Still have other issues but the direct issue in this question is solved by not using nvm to install node. I could then add an npm task in the VSO build definition interface.
Make sure the npm is installed in "C:\Program Files\nodejs\" folder, and then add following in your PowerShell script:
$env:Path += ";C:\Program Files\nodejs\"
Try adding the run npm command build task from:
Add build step -> Add tasks -> Package -> npm (run a npm command)
And add install as command, and the root of the web-project as working directory
Otherwise, try adding the following capabilities:
node.js | C:\Program Files\nodejs\node.exe
and:
npm | C:\Program Files\nodejs\npm.cmd