Node JS and NPM was working well before. Recently I have re-installed the Node JS, NPM and the problem started. After I install a module like example npm install -g bo
I had this same problem and fixed it by adding the 'npm' directory to my PATH:
Right click 'My Computer' and go to 'Properties > Advanced System Settings > Environment Variables'.
Double click on PATH under the 'User variables for Username' section, and add 'C:\Users\username\AppData\Roaming\npm' obviously replacing 'username' with yours. Based on comments below, you may need to add it to the top/front of your path.
Restart your console window or IDE and you should get a response from the bower command.
In my case the npm folder was already in the PATH variable.
If after trying everything else, you also still can't make it work, try to delete the folder from the PATH variable and put it at the beginning of the list.
I had the same problem as well but installed it globally so the other answers didn't work.
The nodeJS install may not have added npm to your PATH so it's not recognised globally.
If there is an npm folder at "C:\Users(your username)\AppData\Roaming\npm" you've installed it for the current user
If there is an npm folder at "C:\Program Files\nodejs\node_modules\npm" or "C:\Program Files(x86)\nodejs\node_modules\npm" you've installed it globally for all users to access
Now depending whether you installed globally or for the current user will determine which PATH variable you are updating and with what path location
Close all terminals or programs that aren't able to find npm and open them up again
If the package is successfully installed and still shows the message "'npm' is not recognized as an internal or external command, operable program or batch file."
Run npm config get prefix
and check the correct npm path first and append the output to the PATH using command or adding manually.
npm config get prefix C:\mydev\tools\npm\npm
set PATH=%PATH%;C:\mydev\tools\npm\npm
You should probably check if your node/bin directory is in your PATH variable. Look for it where you've been installing these global modules.
Im not on windows, so I cant tell you the exact command, but you can check these variables navigating to [Control Panel -> System -> Advanced -> Environment Variables] or something like this.
I hope this helped.