6

iam new to angular.js. iam trying to install bower in Ubuntu 12.04 by entering following code line. node is successfully installed in local machine.

sudo npm install -g bower

getting below error

npm http GET https://registry.npmjs.org/bower

npm ERR! Error: failed to fetch from registry: bower
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/sameer/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.2.0-32-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/sameer
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: bower
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sameer/npm-debug.log
npm not ok

npm-debug.log file contains below code

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'bower' ]
info using npm@1.1.4
info using node@v0.6.12
verbose config file /home/sameer/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1001
silly spawning [ '/usr/bin/node',
silly spawning   [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1001 ],
silly spawning   null ]
silly output from getuid/gid {"uid":65534,"gid":1001}
silly output from getuid/gid 
verbose cache add [ 'bower', null ]
silly cache add: name, spec, args [ undefined, 'bower', [ 'bower', null ] ]
verbose parsed url { pathname: 'bower', path: 'bower', href: 'bower' }
verbose addNamed [ 'bower', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'bower', '', false ]
verbose raw, before any munging bower
verbose url resolving [ 'https://registry.npmjs.org/', './bower' ]
verbose url resolved https://registry.npmjs.org/bower
http GET https://registry.npmjs.org/bower
ERR! Error: failed to fetch from registry: bower
ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at HTTPParser.onIncoming (http.js:1261:11)
ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR!     <http://bugs.debian.org/npm>
ERR! or use
ERR!     reportbug --attach /home/sameer/npm-debug.log npm
ERR! 
ERR! System Linux 3.2.0-32-generic
ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
ERR! cwd /home/sameer
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: bower
verbose exit [ 1, true ]
SameerShaik
  • 488
  • 2
  • 10
  • 22
  • 1
    So, what does `/home/sameer/npm-debug.log` say? – Felix Kling Sep 24 '14 at 15:13
  • Did you make sure that you were connected to the internet? – Chetan Bhasin Sep 24 '14 at 15:13
  • Also, please see the question which may possibly already have an answer to your question. http://stackoverflow.com/questions/12913141/installing-from-npm-fails?rq=1 – Chetan Bhasin Sep 24 '14 at 15:14
  • @Felix Kling - On failure, all logs are written to npm-debug.log in the current working directory. – SameerShaik Sep 24 '14 at 15:20
  • @ChetanBhasin - yes internet is connected – SameerShaik Sep 24 '14 at 15:21
  • 1
    Wait, are you saying that `/home/sameer/npm-debug.log` literally contains *"On failure, all logs are written to npm-debug.log in the current working directory."* ? – Felix Kling Sep 24 '14 at 15:21
  • @chetan - stackoverflow.com/questions/12913141/… in this question he was unable to install node, but is installed node successfully and trying to intall bower – SameerShaik Sep 24 '14 at 15:23
  • @FelixKling - no all logs written in npm-debug.log file – SameerShaik Sep 24 '14 at 15:25
  • Either I don't understand you or you are not understanding me, or both. The point of my first comment was that you should post the relevant information from `/home/sameer/npm-debug.log` because, as the message says, you can find more information about the problem there: `Additional logging details can be found in: /home/sameer/npm-debug.log`. And you are incorrect, in the linked question the OP has already node installed and has troubles to install socket.io (as you can tell by the fact that the OP can run `node --version`). Maybe you should look at that question again. – Felix Kling Sep 24 '14 at 15:26
  • @FelixKling you can see here in the question what npm-debug.log file contains – SameerShaik Sep 24 '14 at 15:40

3 Answers3

19

It seems like you're running a very old version of node and npm. It might need to be updated to install things correctly. I suggest you use the ppa. Please uninstall nodejs and then run this:

curl -sL https://deb.nodesource.com/setup | sudo bash -

This will add the node.js ppa to your repositories, so it will update like any other program. Now you just need to install it, thusly:

sudo apt-get install -y nodejs

and when that's done, run this again:

sudo npm install -g bower
yuvi
  • 18,155
  • 8
  • 56
  • 93
  • The [NodeSource installation instructions](https://github.com/nodesource/distributions#installation-instructions) are also worth a look, especially if you want to install a specific version. The `/setup` script will install Node 0.10, whereas [setup_5.x](https://deb.nodesource.com/setup_5.x) will install Node 5.x. – Dom Stubbs Jan 22 '16 at 10:56
1

Apart from the old version of node which should be upgraded, many (all?) versions of ubuntu install node executable under nodejs name. This creates many issues with with some processes that try to execute node code by invoking node command.

The reason for this is there is another package in ubuntu with the node binary. If you do not need the other package, you may want to create a symlink:

$ whereis nodejs
nodejs: /whatever/path/nodejs
$ cd /whatever/path
$ sudo ln -s nodejs node
Tomasz Rakowski
  • 1,052
  • 4
  • 13
  • 27
0

Follow the following commands you can easily get installed with angularJS

  1. sudo apt-get install nodejs
  2. List item
  3. sudo apt-get install -y python-software-properties
  4. sudo add-apt-repository ppa:chris-lea/node.js
  5. sudo apt-get update
  6. npm config set prefix /usr/local

If you want to install bower use following commands

  1. sudo npm install -g bower
  2. bower install angular#1.3.0-beta.13