Setting up npm behind corporate proxy

Setting up npm behind corporate proxy

When setting up npm in your corporate environment that is behind proxy. Most likely you receive an error like below when installing packages.

npm ERR! request to https://registry.npmjs.org/typescript failed, reason: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827:

To resolve this issue, we need to execute below commands.

Set HTTP proxy

npm config set http-proxy http://proxy.example.net:80

Set HTTPS proxy

npm config set https-proxy http://proxy.example.net:80

Change registry to http

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

Clean NPM cache

npm cache clean --force