I installed the VSO agent using Azure VM and the Visual Studio Release plugin on Azure. I also installed the latest version of node.js (using NVM for Windows). I used the default account when installing the VSO agent, since the credentials that I used for Remote Desktop will not work.
I can retire to the machine and run the script construct I'm trying to run from VSO. I can also run pure .NET assemblies with it, and that is fine. My problems arise when using npm to install my packages and run the build.
I set the build demand as follows:
npm | exists
I installed the feature for the VSO agent from the control panel as follows:
npm | C:\Program Files\nodejs\npm.cmd
Also tried
npm | C:\Program Files\nodejs
I can see npm.cmd in this folder, and I can start npm when I delete this path. I also restarted the VSO agent service on this issue:
TFS build agent cannot find npm
They rebooted the server, and also updated "all agents" several times. I also got npm in my path and can execute it normally when logging in.
Edit:
Error message:
npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\work-folder\1\s\azure-deploy.ps1:24 char:1
+ npm update
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I also tried adding a line as described below:
$env:Path += ";C:\Program Files\nodejs\"
The same mistakes. A of Write-Hostmy $ env: Path write after this command gives:
C:\Application Intallers\agent (1)\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\NativeBinaries\amd64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Users\propertyplotdev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;C:\Program Files\nodejs;C:\Windows\ServiceProfiles\LocalService\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin;C:\Windows\ServiceProfiles\LocalService\.dnx\bin;C:\Program Files\nodejs\
Both C:\Program Files\nodejs\npm.cmdand C:\Program Files\nodejs\node.jsthere, and NETWORK SERVICE has permission to them. (As well as Adiministrators, SYSTEM and my login)