How to configure NPM and Yarn behind proxy server


Here we will configure Npm or Yarn to access internet through proxy server.


1. Open an command prompt or terminal session and type the following commands [enlighter] npm config set proxy http://proxyserver:proxyport npm config set https-proxy http://proxyserver:proxyport npm config set strict-ssl false npm config set registry “” npm –without-ssl –insecure install [/enlighter] Where proxyserver is your proxy server IP address and proxyport is your proxy server Port number.
For example:

For YARN, you need also to run this command [enlighter] yarn config set strict-ssl false [/enlighter]
2. Check Node Configuration by writing the following command [enlighter] npm config list [/enlighter] The output will look like this: [enlighter] ; cli configs metrics-registry = “” scope = “” user-agent = “npm/6.10.1 node/v10.16.0 win32 x64” ; userconfig C:\Users\Armano\.npmrc https-proxy = “http://proxyserver/:proxyport” proxy = “http://proxyserver/:proxyport” ; builtin config undefined prefix = “C:\\Users\\User1\\AppData\\Roaming\\npm” ; node bin location = C:\Program Files\nodejs\node.exe ; cwd = C:\Windows\System32 ; HOME = C:\Users\User1 ; “npm config ls -l” to show all defaults. [/enlighter]
 Make sure that all proxy configuration is correct, and that’s all, you can now use Npm/Yarn behind proxy server