Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"message failed to fetch from registry" while trying to install any module

Tags:

node.js

npm

I can't install any node module from the npm.

npm install socket.io 

The above command resulted to below output, it is not able to install socket.io

npm http GET https://registry.npmjs.org/socket.io  npm ERR! Error: failed to fetch from registry: socket.io npm ERR!     at /opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12 npm ERR!     at cb (/opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9) npm ERR!     at Request._callback (/opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18) npm ERR!     at Request.callback (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:109:22) npm ERR!     at Request.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:198:58) npm ERR!     at Request.emit (events.js:88:20) npm ERR!     at ClientRequest.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:195:10) npm ERR!     at ClientRequest.emit (events.js:67:17) npm ERR!     at CleartextStream.<anonymous> (http.js:1134:11) npm ERR!     at CleartextStream.emit (events.js:67:17) npm ERR! You may report this log at: npm ERR!     <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR!     <[email protected]> npm ERR!  npm ERR! System Linux 2.6.18-194.el5 npm ERR! command "node" "/opt/node0610/bin/npm" "install" "socket.io" npm ERR! cwd /opt/node0610/lib/node_modules npm ERR! node -v v0.6.10 npm ERR! npm -v 1.1.0-3 npm ERR! message failed to fetch from registry: socket.io npm ERR!  npm ERR! Additional logging details can be found in: npm ERR!     /opt/node0610/lib/node_modules/npm-debug.log npm not ok 

My NPM Version is :

[applmgr@dev node_modules]$ npm --version 1.1.0-3 

My NodeJS Version is :

[applmgr@dev node_modules]$ node --version v0.6.10 
like image 349
Dexter Avatar asked Oct 16 '12 10:10

Dexter


People also ask

How do I find NPM registry URL?

You can show the registry of a specific package with the npm view command. When you use npm config get registry you will see the default registry.

How do I completely uninstall NPM?

To completely uninstall node + npm is to do the following: go to /usr/local/lib and delete any node and node_modules. go to /usr/local/include and delete any node and node_modules directory. if you installed with brew install node, then run brew uninstall node in your terminal.

How do I update NPM package manager?

Method 1: Using npm update command to update the node package manager. Method 2: Using npm@latest command to update the node package manager. Method 3: Using PPA repository (only for Linux). Method 4: Using cache cleaning & stable installing (only for Linux).


1 Answers

I had this issue with npm v1.1.4 (and node v0.6.12), which are the Ubuntu 12.04 repository versions.

It looks like that version of npm isn't supported any more, updating node (and npm with it) resolved the issue.

First, uninstall the outdated version (optional, but I think this fixed an issue I was having with global modules not being pathed in).

sudo apt-get purge nodejs npm 

Then enable nodesource's repo and install:

curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt-get install -y nodejs 

Note - the previous advice was to use Chris Lea's repo, he's now migrated that to nodesource, see:

  • https://chrislea.com/2014/07/09/joining-forces-nodesource/
  • https://nodesource.com/blog/chris-lea-joins-forces-with-nodesource

From: here

like image 100
John Carter Avatar answered Oct 21 '22 10:10

John Carter