Using travis-ci with grunt 0.4.x

Update: 26/03/2013 Tim in the comments points out that if you add grunt-cli to your dev-dependencies in your package.json that will also achieve the same solution. I’d recommend his solution here instead of the below.

I thought I’d post a quick set of tips on how to setup on a grunt plugin project as I’d spent a while trying to find the answer.

My problem was that when I followed the travis guide to setup a node.js project all it told me I needed in my .travis.yml was:

language: node_js
  - "0.8"

However I kept getting failing builds which said:

> grunt test

sh: 1: grunt: not found
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

After a bit of digging around in some other projects it turns out you need one extra thing for a Grunt 0.4.x project to work:

language: node_js
  - "0.8"
  - npm install -g grunt-cli

After adding that travis was able to find grunt and I was back to green.

Feel free to look at for a working build setup.

5 thoughts on “Using travis-ci with grunt 0.4.x

  1. @Daniel – that’s true. I basically copied what I found the grunt project doing and so assumed that’s the right way, but you make a good point. If I do it your way then I don’t need to install it globally. However I assume (perhaps wrongly) that travisci would clean up any global installations of modules people make and ensure everything is sandboxed for all jobs.

Leave a Reply