If you’re following a tutorial which uses grunt and all of a sudden you’re getting this issue then read on for the quick and simple fix.
I must admit, living in the Microsoft development world had left me a bit out of date with what was going on in the rest of the web developer scene. I’d heard words like Bower, Grunt, Gulp, Yeoman but they all seemed to be outside my sphere of interest.
Now that I’m getting more involved in this side of development (and co-incidentally the next version of asp.net is actually going to embrace this in a big way too) I’m getting to go through all the fun n00b issues that come with learning new technologies.
Today’s head scratcher? Figuring out why, when I was following an innocent getting started tutorial, I was getting this error:
'grunt' is not recognized as an internal or external command, operable program or batch file.
As I’m developing on a Windows machine, which seems to be a dirty word amongst these command line technologies, I always feel a prang of “oh well this doesn’t work on Windows” whenever I get an error. This time however it turned out that it wasn’t Windows fault, it was just that Grunt has recently updated it’s structure and the tutorial hadn’t caught up with this yet.
If you get this error then you simply need to install the command line interface grunt package. It’s as simple as typing this into your command line:
npm install -g grunt-cli
The –g installs it globally and puts it in your PATH environment variable. Note: You need to run your command shell as Administrator to do this.