I am using Travis CI to test and build my project and as part of it I want travis to run grunt build i have tried the following but have had no luck.
grunt build
You likely miss in your travis.yml file:
before_script: - npm install -g grunt-cli
Then "grunt whatever" should execute ok (assuming you do require grunt in your devDependencies in your package.json).
(see http://www.mattgoldspink.co.uk/2013/02/10/using-travis-ci-with-grunt-0-4-x/)