I have successfully installed nodejs, and express framework, however I downloaded bower via
npm install -g bower
which ran successfully.
Sometimes even after Scott's steps do not resolve the problem. Open the command prompt in admin mode. This resolves the problem
Although we have already good answers here, I will give an extra hint. Check if you have a .npmrc file inside the folder /Users/YOUR_USER/. When this problem happened to me, my .npmrc file had this content:
http_proxy=http://<LOGIN>:<PASSWORD>@<PROXY>:<PORT>
https_proxy=http://<LOGIN>:<PASSWORD>@<PROXY>:<PORT>
proxy=http://<LOGIN>:<PASSWORD>@<PROXY>:<PORT>/
https-proxy=http://<LOGIN>:<PASSWORD>@<PROXY>:<PORT>
prefix = "D:\\<SOME_DIR>\\nodejs"
cache = "D:\\<SOME_DIR>\\nodejs\\npm-cache"
Due to prefix and cache lines, the bower was being installed inside the folder specified in prefix.
SOLUTION: I deleted prefix and cache lines. The I installed bower again with the following command:
npm install -g bower
After that, my bower became global as expected.
I have faced the same problem. I have solved by using the following steps
Go to Control Panel\System and Security\System and click Advanced system settings
In that you can see Environment Variables in Advanced tab. Now ,Environment Variables Window opens.
Select the path and click Edit button and add C:\Users\\AppData\Roaming\npm . Click ok to save.
Note : before adding path add a colon(;) in front of that path if not there for previous one
Now you can able to install bower . Hope it helps.
I just wanted to add update to windows 10 users, I found that typing bower into the search bar will return "run command" option. Execute that and it will then prompt if bower can submit info, return a y/n and you should be good to go.
SCREENSHOT
I am using Windows 7 as well and had this problem too.
After I took the steps outlined in Scott Marchant's answer, bower worked.
Find the location of your npm global binaries: npm config get prefix. This path may look something like C:\Users\username\AppData\Roaming\npm. Add the path from step 1 to your Path.
Open the Windows Control Panel, search for environment, then click on either edit environment variables for your account, or Edit the system environment variables`.
Find the variable named Path or PATH, or create one if it doesn't exist.
Paste the path from step 1 here (; delimited).
You may need to restart your command prompt window.
You should now be able to enter bower commands.