Thursday, July 2, 2015

Error intalling node package manager npm before trying to install bower

Article written by Ganesh Prasad

Senior RoR Developer

Before installing Bower, which is a JavaScript command-line application, we need to setup npm (Node Package Manager)
If you already have old version installed then installing bower will throw following errors.

npm install -g bower
npm http GET http://registry.npmjs.org/bower
npm http 304 http://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!    
npm ERR! or use
npm ERR!     reportbug --attach /home/ganesh/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.2.0-53-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/ganesh
npm ERR! node -v v0.6.12
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!     /home/ganesh/npm-debug.log

npm not ok


Solution:

1) To fix the issue first uninstall the older version of npm (nodejs) packages that are already installed using the following command

sudo apt-get purge nodejs npm
2) Next install node js using the following command.

curl -L https://raw.github.com/midnightcodr/rpi_node_install/master/setup.sh | bash -s 0.10.24

3) Now that you have installed node js successfully, then install npm using the following command.

sudo apt-get install npm
4) Next you can install bower with the help of npm using the following command.

sudo npm install -g bower



No comments:

Post a Comment