Grunt on Windows 8: 'grunt' is not recognized
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]AppDataRoamingnpm
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:
Am I missing something obvious?
Confirm your PATH
is correct (and not messed up). Just type PATH
from the command prompt. There's really no other explanation that makes sense given the error you're describing and the steps you've taken.
Normally, using the where grunt
command would have found grunt.cmd
in your path if npm
is installed correctly and it has been properly added to the system path.
I've not had any issues with grunt on several different windows 8 machines.
If you open the folder: C:Users[username]AppDataRoamingnpm
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]AppDataRoamingnpm
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?
PATH
Enter and verify if C:UsersUsernameAppDataRoamingnpm
is part of the path. or close the Command Prompt and restart the
explorer
process. In the Command Prompt, type where grunt
Enter.
You're good if it reports:
C:UsersUsernameAppDataRoamingnpmgrunt
C:UsersUsernameAppDataRoamingnpmgrunt.cmd
Otherwise, you have to reinstall the grunt-cli
package if it reports:
INFO: Could not find files for the given pattern(s).
Apparently, programs that change the PATH
environment variable must broadcast a WM_SETTINGCHANGE
message. The Windows' System settings window does it correctly when you change the PATH
variable, but the NPM installer doesn't. That's why you have to restart explorer (or log off or restart, which has the same effect).