57

I am using bower

$ bower -v
0.9.2

latest version of bower is 1.x.x https://github.com/bower/bower/releases

I run to update bower to the latest version

npm update -g bower 

this does not help

I still have

$ bower -v
0.9.2
Nedudi
  • 5,639
  • 2
  • 42
  • 37
  • 3
    "directly involve tools used primarily for programming" - what would a person use Bower for other than application dev? Markup isn't strictly code, but this is often used for grabbing javascript libraries, and you install bower via node package manager. Nobody is installing NodeJS for "general computing." This is not a power-user question, and should not have been closed. Boo. – Jeremy Anderson May 02 '15 at 11:33

3 Answers3

97

1) you have to clear npm cache and then update bower

sudo npm cache clean
npm update -g bower

2) If 1st solution does not help

try to remove and install it again

npm -g uninstall bower
npm -g install bower

check if it is still here

which bower

if it will show you something like

/usr/local/bin/bower

then

rm <path from previous command>

and after install it again

npm -g install bower

open new bash window and enjoy latest version of bower

same will help with other packages

Nedudi
  • 5,639
  • 2
  • 42
  • 37
  • 1
    Interestingly npm update -g bower was updating my bower to the latest but when I was checking the version with bower --version, it showed me the old version. I removed the old package from .npm/bower/ and then it recognized the new version! – mohi Jun 06 '15 at 10:38
  • `which bower`? was is das,? it does not works from the command line – serge Oct 13 '15 at 23:20
  • oh, man, you could mention that you use `ubuntu` as OS (geek?) – serge Oct 13 '15 at 23:30
  • osx, but.. nevermind.. )) And, yes as "geek" as everyone who uses bower – Nedudi Oct 15 '15 at 14:24
1

There could be a lot of moving parts here. First you should try

npm cache clean
sudo npm cache clean
npm update -g bower

…which is –given all the moving parts– not very likely to work for you.

On Mac, using brew and nvm with some history, you would do something like this:

1. figure out where bower is now

 $ which bower
 /usr/local/share/npm/bin/bower
 $ ls -hal /usr/local/share/npm/bin/bower
 lrwxr-xr-x  1 iwein  admin    35B Dec 15  2013 /usr/local/share/npm/bin/bower -> ../lib/node_modules/bower/bin/bower
 $ ls -hal /usr/local/share/npm/lib/node_modules/bower/bin/bower 
 -rwxr-xr-x  1 iwein  staff   3.3K Sep 17  2013 /usr/local/share/npm/lib/node_modules/bower/bin/bower
 $ bower -v
 1.2.8
 $ rm -rf /usr/local/share/npm/lib/node_modules/bower

2. reinstall bower using npm

 $ npm install -g bower
 /Users/iwein/.nvm/v5.11.1/bin/bower -> /Users/iwein/.nvm/v5.11.1/lib/node_modules/bower/bin/bower
 /Users/iwein/.nvm/v5.11.1/lib
 └── bower@1.7.9

 $ bower -v
 bash: /usr/local/share/npm/bin/bower: No such file or directory
 $ which bower
 /Users/iwein/.nvm/v5.11.1/bin/bower
 $ bower
 bash: /usr/local/share/npm/bin/bower: No such file or directory
 $ ls -hal ~/.nvm/v5.11.1/bin/bower
 lrwxr-xr-x  1 iwein  staff    35B Jun  1 11:53 /Users/iwein/.nvm/v5.11.1/bin/bower -> ../lib/node_modules/bower/bin/bower

3. open a new terminal

…or source your .profile or whatever. Check if you're using the same node version (implying a different nvm version if you don't)

 $ which bower
 /Users/iwein/.nvm/v0.10.24/bin/bower
 $ bower -v
 1.4.1
 $ nvm use 5
 Now using node v5.11.1
 $ which bower
 /Users/iwein/.nvm/v5.11.1/bin/bower
 $ bower -v
 1.7.9

And you're good.

Note that:

  1. you have to make sure you are installing in the right place, you may need multiple versions of bower, nvm, npm or node on your system for different projects…
  2. you need to restart the terminal to make sure the linking is done correctly.
iwein
  • 25,788
  • 10
  • 70
  • 111
0

Probably the bower update worked fine, it's just missing update environment var.

On my Ubuntu was something like:

ln -sf /usr/local/n/versions/node/6.2.0/bin/bower /usr/bin/bower
Rfps
  • 36
  • 3