module is not Recognized as an Internal or External Command

2016/4/22 min read
bookmark this
Responsive image

You'll often see following error when running npm command at windows OS system.

'Gulp' is not recognized as an internal or external command, operable program or batch file. 
'Bower' is not recognized as an internal or external command, operable program or batch file.
'yo' is not recognized as an internal or external command, operable program or batch file.

Basically you have to add to Path to Environment Variables's Path.

How to enable gulp?

For gulp, you will have to add following path to Path System Variables, so command line will recognize npm's global path. Also install gulp so run command as gulp will be recognized. At the end, you'll have to restart the command line if you have not restart command line after change the system variables.

  • Add path to windows System Variables
    • %USERPROFILE%\AppData\Roaming\npm
    • C:\Program Files\nodejs\
  • Run npm install command to install gulp
    • npm install -g gulp
  • Restart windows command line.

How to enable bower?

If you already setup gulp, then the only think you have to do is run npm for bower as global.

  • npm install -g bower

Git is not recognized too?

  • Go to windows' Enviroment Variables and edit the the path variables, make sure contains following path also make sure following location Git is actually exist.
    • Could be either these 
      • %PROGRAMFILES(x86)%\Git\bin
      • %PROGRAMFILES(x86)%\Git\cmd
    • Or Maybe 
      • %PROGRAMFILES%\Git\bin
      • %PROGRAMFILES%\Git\cmd

How to enable yo?

It is the same as bower at this point, you will need to install yeoman as globally.

  • npm install -g yo

If you can't install yo and command line display error contains as If you are behind a proxy, please make sure that the 'proxy' config is set properly. Try run npm config ls -l, this command will show all the config setting for npm, check the proxy, if the proxy is null, change it to http://registry.npmjs.org/ as following command.

npm config set registry http://registry.npmjs.org/

Still not working!?

Before trying to figure out what's happening, restart your command line again, might works. Also, it is better to use Node.js command prompt.