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

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


https://github.com/isaacs/npm/issues/2119

I had to execute the command below:

npm config set registry http://registry.npmjs.org/

However, that will make npm install packages over an insecure HTTP connection. If you can, you should stick with

npm config set registry https://registry.npmjs.org/

instead to install over HTTPS.