npm: ERR! should not happen... and running behind proxy

Sometimes one can get messages like the following during npm install:

npm ERR! should not happen...
npm ERR! should not happen...
npm ERR! should not happen...

That usually means some host answered with error which should definitely not happen. That can happen if your computer is working behind the proxy.

In order to specify HTTP proxy one needs to do the following:

npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy "http://localhost:8118/" # Proxy URL goes here.
npm install ...