I have installed npm and grunt on our TFS build server. I installed the grunt-cli using npm install -g grunt-cli and was then able to run grunt deploy from the command line when logged in as myself.
Out TFS builds run as the tfsservice user though, and when it attempts to do grunt deploy it gets an error message that:
'grunt' is not recognized as an internal or external command, operable program or batch file.
So, while logged in as myself on the build server, if I run the command prompt as tfsservice I get the same error. So I tried doing npm install -g grunt-cli from that command prompt, and it looked to have installed properly and created the grunt files in C:\Users\tfsservice\AppData\Roaming\npm, but then I still get the same error when running grunt deploy.
So it looks like grunt-cli is not getting installed for tfsservice? When I get the tfsservice %homepath% I see that it is set to \Windows\system32, rather than the expected \Users\tfsservice; maybe it being a service account has something to do with it?
I see that a similar questions has been asked for using grunt-cli with Team City, but it recommends using a Team City specific plugin.
There's also this post which says they changed Team City run as a different user and then everything just started working properly. Changing our builds to run as a different user than tfsservice isn't really an option for me though.
Any suggestions are appreciated. Thanks.