Grunt on Windows 8: 'grunt' is not recognized

Daniel Attfield picture Daniel Attfield · Oct 2, 2013 · Viewed 68.1k times · Source

I'm having a problem running Grunt from the command line on my Windows 8 machine.

My research indicates the most common solution is to install grunt-cli, since Grunt is no longer global. I also need to make sure I actually install the Grunt task runner, since that's not installed with grunt-cli.

Other solutions point to the PATH system environment variable, but that appears to be pointed as I'd expect to:

C:\Users[username]\AppData\Roaming\npm

Having done all that, I'm still getting a "'grunt' is not recognized as an internal or external command, operable program or batch file" error message in the CLI. I've tried the following things, uninstalling everything after every attempt:

  • Installed grunt-cli globally (npm install -g grunt-cli), then grunt at the directory level I want to use it (npm install grunt)
  • The same as above, but with the order of installation reversed
  • The same as both of the above, but using the Admin Command Prompt

Am I missing something obvious?

Answer

Rik Leigh picture Rik Leigh · Oct 2, 2013

I've not had any issues with grunt on several different windows 8 machines.

If you open the folder: C:\Users\[username]\AppData\Roaming\npm

Do you have a file named grunt.cmd in this folder?

If not I'd maybe try npm install -g grunt-cli again, maybe from an elevated command prompt.

If this exists and you have C:\Users\[username]\AppData\Roaming\npm in your PATH environment variable then typing grunt from a command prompt should work.

Silly question, have you tried closing the command prompt and opening a new one?