grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Windows: 'grunt' is not recognized as an internal or external command

Open mcandre opened this issue 13 years ago • 41 comments

When I npm install -g grunt, grunt is not adding a binary to C:\Documents and Settings\apenneba\npm\. The result is that attempts to run grunt in Command Prompt fail with:

'grunt' is not recognized as an internal or external command

System:

I repeated npm install -g grunt, grunt in Command Prompt as well as Git Bash. In either case, grunt fails to add itself to PATH.

Other packages like mocha, jshint, nodeunit, and tap are successfulling adding themselves to PATH.

$ specs node git os
Specs:

specs 0.4
https://github.com/mcandre/specs#readme

npm --version
1.2.17

node --version
v0.10.3

git --version
git version 1.8.0.msysgit.0

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 3 Build 2600

mcandre avatar May 02 '13 17:05 mcandre

See the getting started guide http://gruntjs.com/getting-started grunt is no longer installed globally

nschonni avatar May 02 '13 17:05 nschonni

@nschonni Just beat me to it :) npm install -g grunt-cli

shama avatar May 02 '13 17:05 shama

@shama, @nschonni Thanks! Works for me!

mcandre avatar May 02 '13 18:05 mcandre

Hey Thanks shama,, It worked for me as well :)

preethamcka avatar Jul 17 '13 18:07 preethamcka

This popped up again to me :(

tomasdev avatar Nov 12 '13 15:11 tomasdev

Doesn't work for me. Installed it via npm install -g grunt-cli, as administrator and via my user account. Didn't work either way.

schlingel avatar Nov 28 '13 13:11 schlingel

@tomasdev @schlingel Make sure the path to node is correctly configured. Try node -v and it should display the version of node you're running. If that works and you've npm install grunt-cli -g then try where grunt to see if you can find it on Windows.

shama avatar Nov 28 '13 20:11 shama

@shama I did all of the above steps but when i run "where grunt" command it says where is not recognized command

akitrav avatar Dec 02 '13 07:12 akitrav

I did all of the above steps, but had to add the following to the PATH environment variable on Windows 7 in a Domain %USERPROFILE%\AppData\Roaming\npm

mhanney avatar Dec 03 '13 18:12 mhanney

@mhanney, that could be related to a year-old issue I filed on the Node.js installer: joyent/node#4228.

cowboy avatar Dec 03 '13 19:12 cowboy

Had the same problem and running following command in the shell solves it path=%PATH%;%APPDATA%\npm

ghost avatar Dec 10 '13 21:12 ghost

path=%PATH%;%APPDATA%\npm Works for me. The only problem I have is that I have to use this every time I restart my machine.

liamjay avatar Dec 13 '13 09:12 liamjay

thank you thank you thank you path=%PATH%;%APPDATA%\npm worked for me too

emcrorie avatar Jan 03 '14 14:01 emcrorie

Try echo ~ for the path ;)

franz-josef-kaiser avatar Jan 30 '14 13:01 franz-josef-kaiser

Same problem, but solved by @mhanney's suggestion, I just added that line to my environment variables and now grunt is recognized by the command line.

helgatheviking avatar Mar 02 '14 22:03 helgatheviking

need to reboot computer after config environment variable.

rubi avatar Mar 10 '14 07:03 rubi

need to reboot computer after config environment variable.

Also in some cases just reopening CMD works.

vladikoff avatar Mar 10 '14 14:03 vladikoff

Worked. Thanks @shama and @nschonni.

dylanhein avatar Apr 11 '14 17:04 dylanhein

@andi69 thanks! that was frustrating...

eriksjaastad avatar May 14 '14 17:05 eriksjaastad

npm installs executables to: npm config get prefix on windows7 it's %AppData%\npm, though adding %AppData%\npm to %PATH% doesn't work. Instead add this to %PATH%: %USERPROFILE%\AppData\Roaming\npm

rofrol avatar May 18 '14 15:05 rofrol