bower command not found windows

Solution 1:

I bumped into this problem after npm install -g bower too. I solved the problem by adding npm's binary folder to my path.

Here are some helpful hints for doing that:

  1. Find the location of your npm global binaries: npm config get prefix. This path may look something like C:\Users\username\AppData\Roaming\npm (or C:\ProgramData\chocolatey\lib\nodejs.commandline.X.XX.XX\tools if you use Chocolatey).
  2. 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.

  3. You should now be able to enter bower commands.

Solution 2:

in case this helps.

I'm a npm / bower nooB - but what happened in my case was, that I was using the Angular JS tutorial, which seems to have bower set up to be used via npm, and NOT via the command line directly.

Note: in my case I think my bower install got messed up. I ran this to fix up my bower install:

npm install -gf bower

Then I edited my bower.json file to add in a new library that I wanted to use (in my case angular-sanitize)

I CD to the location of my project

cd myProjectPath

Then to run bower, I actually used npm install:

npm install

This seems to to run bower as a node package, which in turn scans bower.json and installs any missing bower packages.

To run bower as a npm package, add npm before the bower command:

npm bower -v

hope this helps,

Sean

Solution 3:

If above solutions don't work. I think you should specify the absolute path to use the bower in command prompt. In my app folder, I just call

C:\Users\yourusername\AppData\Roaming\npm\bower.cmd install

This is content in my bower.cmd. It looks like my windows can't recognize the ~dp0 variable,

node  "C:\Users\yourusername\AppData\Roaming\npm\node_modules\bower\bin\bower" %*

Solution 4:

This definitly will happen if your Windows PATH variable close to 1024 symbol length. So new links such "C:\Users\username\AppData\Roaming\npm" simply won't fit into that.

Check your PATH, remove extra stuff and try to reinstall node.js and bower etc. Also there is a way to increase 1024-length limit

Solution 5:

As others mentioned have to add bower into environment variables, but the easiest way to locate is just simply type in your npm location first, then use Browse File and locate bower on your system(you can search for it in search bar as well), because the location may vary for different users.

sample in my end