Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity build runner not recognizing executable

Tags:

I'm trying to run a simple gruntfile.js as part of my build in TeamCity. However, even after installing grunt and grunt-cli as global node packages, TeamCity still won't recognize them. I can type grunt in the command line and it works, but when I run it in TeamCity either through a command line runner or an executable with parameters, it still gives

'grunt' is not recognized as an internal or external command

I also tried installing TeamCity.Node, which is a plugin for running grunt scripts, but it can't find grunt either. Any ideas?

like image 304
Caleb Jares Avatar asked May 07 '13 22:05

Caleb Jares


1 Answers

I couldn't get the accepted solution to work. The problem for me was that TeamCity services (server and agent) were running under system accounts. AFAIK, there is no concept of "globally install npm package for all users of the OS". So I:

  1. created a TeamCity windows user
  2. changed the TeamCity services to run as that user
  3. logged into the OS as the TeamCity user
  4. ran npm install -g grunt-cli
  5. restarted the services.

From there, the NodeJS, NPM and Grunt tasks just started working.

like image 114
Christopher Avatar answered Sep 21 '22 13:09

Christopher