npm install Error – failed to fetch from registry

It is possible that while playing with Node JS you may end up with errors which states  “failed to fetch from registry”. Following picture is an example of what I encountered.

Screenshot from 2016-04-08 16:52:12

The fix for this issue is try running the command added below. For me it worked.

npm config set registry  




Installing Latest Version of Node.js and NPM

The easiest way to upgrade node.js and npm, in my opinion is to uninstall existing node.js and npm and which can be done with this single command

                                  sudo apt-get remove nodejs

Now we need to install latest version of nodejs and npm and both can be achieved with single command as in the previous case. But  before that we need to update the repossitory. For that try running the following terminal command

curl -sL | sudo bash -

If you don’t have “curl” installed in your system, you will have to do that with the following command

sudo apt-get install curl

Now  finally it is time to run the command  sudo apt-get install nodejs      to install nodejs and npm in a single go (installing nodejs will install npm also).

Now check the node js and npm versions using the command
                            node -v
                            npm -v

You can see that both are of the latest versions

Ref :

NodeJS – Issues


When you try to install nodeJs packages like expressJS via package.json you may stuck up with this error. This is due to the fact that you are using an older version of npm and npm no longer supports its self-signed certificates.

To fix this

Solution 1.  

you can either upgrade your npm (it is what i did) using following command

npm install npm -g –ca=null

Solution 2

Or you can tell the npm to use existing registrars as below.

npm config set ca=””