Not able to install bower using npm on Ubuntu 13.04

I am not able to install bower.

Steps carried out :

  • Installed node.js (current stable version v0.10.12)
  • Installed npm using apt-get (v1.1.4)

Tried installing bower using : npm install bower

I get the possible node.js incompatible error. The weird thing is that the error log indicates that the script went to the node directory & tried node -v to get an old version of node.js (v0.6.19) though when I do so manually I get v.0.10.12.

Error Log :

npm http GET https://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /usr/share/node-v0.10.12/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-25-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "bower"
npm ERR! cwd /usr/share/node-v0.10.12
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/share/node-v0.10.12/npm-debug.log
npm not ok

Need a way to install bower. Any ideas ?

I had the same issue on ubuntu 12.04 here is how I fixed it:

As GabLeRoux mentioned, Node version manager requires curl package to be installed and therefore you might need to install curl before:

sudo apt-get install curl -y

1) Clear NPM's cache:

sudo npm cache clean -f

2) Install a little helper called 'n' (node version manager)

sudo npm install -g n

3) Install latest stable NodeJS version

sudo n stable

4) Install Bower again

sudo npm install -g bower

Try this, because you must install it as superuser:

sudo npm install bower

You must type in your su password.

I recommend using the linux binary from nodejs.org. Available for both 32-bit and 64-bit versions and installs with NPM:

http://nodejs.org/download/

This should prevent any node/npm version conflicts.

For Cent OS users -

I first had to update NPM to get around this, and was getting errno 34 for bower on CentOS 7

sudo npm install -g npm
sudo npm install -g bower

If you get sudo npm command not found, you can edit /etc/sudoers to include npm bin path

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin