Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

getting grunt to work on windows with cygwin and git


Getting grunt to work with Cygwin and git on Windows is a bit difficult considering the cygwin package that is installed by git has an outdated version of node running on it (at least that was the case in Windows XP). There are several issues to work through:

  1. Cygwin by default installs an old version of node, this was only the case in my Windows XP machine.
    1. Open Cygwin shell
    2. which node tells you where the executable is
    3. node --version tells you if it's old
    4. cd to the directory listed by which node
    5. mv node.exe node.exe.bak
    6. download node from and install it
  2. Node installed through installer MIGHT not update PATH to point to correct version of node installed normally.
    1. on my Windows XP: it was /c/Documents and Settings/mike/Application Data/npm:/c/Program Files/nodejs
    2. on my Windows 7 machine: it was in /c/Users/Mike Sherov/AppData/Roaming/npm:/c/Program Files (x86)/nodejs/
    3. to see current path: echo $PATH
    4. to set path: export PATH="your path here"
    5. i added /c/Documents and Settings/mike/Application Data/npm:/c/Program Files/nodejs: to my path
  3. grunt needs to be installed globally and locally
    1. cd to your jquery top level directory
    2. npm install will install local grunt and grunt-compare-size
    3. npm install -g grunt will install the global grunt that is recognized as in the PATH

that should be it, at least that's what worked for me

What is Cygwin needed for if node is distributed as a Windows binary?


git bash

Ah, I think your gist description could provide a bit more context. Grunt works on Windows without Cygwin because it depends only on node, not git or bash.


@rdworth, I've updated it. I provided this gist because several other jquery core guys were having trouble gettings cygwin and grunt and node and git to play nicely together.

It might be useful for this to be added to the grunt FAQ.


@cowboy, I agree. I want to get some confirmation from other windows people first that this is a real fix and not just some noise, but feel free to use it how you like!

@mikesherov i saw in your email that you use Windows XP. Node.js doesn't officially support Windows XP, and I've definitely experienced problems with it. I can't remember if they were filesystem or child process based issues, but they were very real and a huge PITA at the time.

Just figured I'd mention it.

fwiw I'm using grunt inside PowerShell in Windows 7 without Cygwin (I use msysgit for git and don't need bash). It also works in regular old Command Prompt, difference being (from PowerShell) that you have to type grunt.cmd instead of grunt


@rdworth, good to know.

As well as I made out with Windows 7, I got tripped up by a child process issue (Error: CreateProcessW: The system cannot find the file specified.) with grunt.utils.spawn("git",...) @cowboy see


@rdworth, good find.

The whole grunt.cmd vs grunt and npm.cmd vs npm is a bit grating ... @rdworth are you relatively happy using PowerShell? I like working in cygwin/bash since it's a "real" shell. I suppose I could alias them.

cowboy commented

@dmethvin that should no longer be an issue in grunt 0.4.0 when the gruntfile is renamed to Gruntfile.js from grunt.js, but in the meantime, check out the FAQ.

cowboy commented

(at least, I think)

sj314 commented

Nodejs supports Windows now officially, forget Cygwin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.