71

I have successfully installed nodejs, and express framework, however I downloaded bower via

npm install -g bower

which ran successfully.

However whenever I try to install something with bower I get the error message

bower is not recognised as an internal or external command

when I search my computer for bower or a bower.exe I cannot locate it.

Bob Gilmore
  • 12,608
  • 13
  • 46
  • 53
Joe Smith
  • 735
  • 1
  • 5
  • 4
  • 2
    OS? What command are you using to install something with Bower? – Scimonster Dec 08 '14 at 15:02
  • sorry I am using Windows 7, and I am using the command " bower install angular" – Joe Smith Dec 08 '14 at 15:04
  • 2
    possible duplicate of [bower command not found windows](http://stackoverflow.com/questions/21732447/bower-command-not-found-windows) – Qantas 94 Heavy Jan 22 '15 at 15:00
  • Related post - [bower command not found](https://stackoverflow.com/q/12369390/465053) & [Bower: “command not found” after installation](https://stackoverflow.com/q/15846076/465053) – RBT May 27 '18 at 06:43

13 Answers13

60

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.

Community
  • 1
  • 1
jaycer
  • 2,941
  • 2
  • 26
  • 36
54

I solved this issue using command

$ npm install -g bower

make sure -g exist in command.

I am using os Window10.

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Kishor K
  • 1,435
  • 12
  • 16
36

Installing Bower Windows:

  1. Install Node.js (required)
  2. npm install -g bower
  3. Add to the Path environment variable for your both Systems and Users like this:

;C:\Users\me\AppData\Roaming\npm\node_modules\bower\bin

  1. Restart your machine
  2. Open command prompt anywhere and type bower to verify that it works. DONE.
Jim Aho
  • 9,932
  • 15
  • 56
  • 87
Dung
  • 19,199
  • 9
  • 59
  • 54
8
  1. Open cmd
  2. Check bower is installed successfully:

    bower version -v If bower version showed then go to step 3, else execute:

    npm install -g bower to install bower

  3. Close and re-open cmd (to apply new environment variables)
  4. using CD command to navigate to folder that has bower.json file then run

    bower install DONE.

Brian Vo
  • 951
  • 9
  • 8
4

Sometimes even after Scott's steps do not resolve the problem. Open the command prompt in admin mode. This resolves the problem

  • Thanks Nagesh.. opening Command Prompt in Windows with "Run as Administrator" resolved my problem. I was able to launch bower. :) – Tarun Jul 01 '15 at 09:35
  • I had the opposite problem - I had installed node under my normal user account but was running the command prompt as Administrator (instinctively!). This answer helped, thanks. – Aaron Proctor Nov 13 '15 at 21:29
4
  1. Press Window+R
  2. %appdata% Press Enter Key
  3. C:\Users\xyz\AppData\Roaming\npm
  4. Double Click bower.cmd icon
  5. Press Shift Right Mouse Click Then Selec Open Command Window Here
  6. Paste bower install MDBootstrap

SCREENSHOT enter image description here

Ram Pukar
  • 1,583
  • 15
  • 17
1

Check were your cmd prompt/bash is located when you have successfully commanded "npm install"

Look for the any of the following. -bower.cmd - windows command script -bower - file you can do a quick search in the directory.

if you find it, copy the path to the file. "I found mine in the directory where I successfully performed npm install" + node_modules.bin" - "D:\Work\notepadplusplus\htdocs\laravel-main\angulartest\public\fed\node_modules.bin"

Then do these

  1. Open the Windows Control Panel
  2. Go to Advance
  3. Environment Variables
  4. Click on either edit environment variables for your account, or Edit the system environment variables`.
  5. Find the variable named Path or PATH, or create one if it doesn't exist.
  6. Paste the path from your search earlier (; delimited and without any space).
  7. restart your command prompt window or your bash window.

There is no specific path since we all have different structure of our directories. The only precise thing here is to find the bower.cmd location and that will be used to the Path to your windows environment.

jonglarida
  • 11
  • 1
1

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.

André Leitão
  • 240
  • 1
  • 3
  • 9
1

C:\Users\[username]\AppData\Roaming\npm;

should exist in PATH for both "User Variables" and "System Variables"

bonda
  • 11
  • 4
1

I have faced the same problem. I have solved by using the following steps

  1. Go to Control Panel\System and Security\System and click Advanced system settings

  2. In that you can see Environment Variables in Advanced tab. Now ,Environment Variables Window opens.

  3. 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.

Sakthi
  • 11
  • 1
0

I resolved the issue my changing access rights of node.js folder. I gave Read-Write access to the file and issue resolved. node.js file path: C:\Program Files\nodejs

0

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.

Nick k
  • 1
  • 1
0

Add the directory of bower to the PATH environment variable. Avoid having any space between directories:

C:\Program Files\nodejs;C:\Users\W\AppData\Roaming\npm\node_modules\bower\bin;C:\Users\W\AppData\Roaming\npm

To me it helped to remove the user variable and write the PATH environment variable in the System variables.

  • The above worked for me: I added : RUN setx PATH '%PATH%;C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\msbuild.exe;C:\\Users\\ContainerAdministrator\\AppData\\Roaming\\npm;C:\\Users\\ContainerAdministrator\\AppData\\Roaming\\npm\\node_modules\\bower\\bin;' to my docker file after in installing node, and all was well. – leeroya May 30 '18 at 05:59