Running Gulp and NPM in VSO Build fails with “Run as Administrator” message

The past months I’ve been heavily involved with Angular and ASP.NET Web API projects. While moving a project from an on-premise build server to Visual Studio Online I ran into an issue for which I could not find any solution at first. The default npm task was failing for no apparent reason and just outputted that the task had to be run as Administrator.

Long story short, I added the –force attribute and suddenly the issue was resolved.


Since I wanted to write this down, I had to reproduce the issue. So I removed the attribute again but the build somehow kept building. I had also deleted the failed builds so I have no log anymore to illustrate the issue.

Something has changed though as the builds now take much longer than before, even without the force attribute. You can see that in the image below. Hopefully I don’t run into it again, I added the force attribute after reading this GitHub issue.