2

I tried to install grunt using npm, which errors out, without giving me much detail into the reasoning.. reproducing the log here.

npm -v
1.1.4

sudo npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli

npm ERR! Error: failed to fetch from registry: grunt-cli
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.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/raghav/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.5.0-47-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/raghav
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: grunt-cli
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/raghav/npm-debug.log
npm not ok

Tried to confirm if the server i actually accessible, and here it is -

ping registry.npmjs.org
PING a.sni.fastly.net (103.245.222.162) 56(84) bytes of data.
64 bytes from 103.245.222.162: icmp_req=1 ttl=50 time=243 ms
  • I just tested on my 13.10 using npm version 1.2.18 and it installed without any problems. Perhaps you should try upgrading either the system or npm. – terdon Mar 18 '14 at 23:47
  • Can you edit your post to include the contents of /home/raghav/npm-debug.log? – yjwong Mar 19 '14 at 1:59
  • Are you working behind a proxy? I am working behind a proxy and I am facing the same problem. – IcyFlame Apr 10 '14 at 8:28
  • No i m not behind any proxy. – Gyan Apr 17 '14 at 17:55
  • See here: stackoverflow.com/questions/12913141/installing-from-npm-fails The second answer did the job for me – user285798 May 27 '14 at 14:52
5

As @geon noted over on StackOverflow:

I used apt-get to install node. Npm was not included in that package, so it had to be installed separately. I assumed that would work, but apparently the npm version in the Ubuntu distribution was outdated.

The node wiki has this instruction:

Obtaining a recent version of Node or installing on older Ubuntu and other apt-based distributions may require a few extra steps. Example install:

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

After that, npm was already included and worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.