Monday, 14 March 2016

Solved: Npm behind proxy issue 100% tested and verified

/**
 * Clear Cache first and set strict-ssl equal to false
 */
npm cache clear
npm config set strict-ssl false

/**
 * Then set proxy and https-proxy 
 * username: your username used over proxy
 * password: your password used over proxy if containa @ symbol then replace it with %40 For eg. dave@1234 then it should be dave%401234
 * host: your host name used for proxy settings(proxy server name)
 * port: your proxy port number
 */

npm config set proxy "http://username:Password@host:port/"
npm config set https-proxy "http://username:Password@host:port/"
npm config set registry "http://registry.npmjs.org/"

/**
 * Then check your proxy settings fine or not
 */
npm config list



Output should be like this: 
; cli configs
user-agent = "npm/2.14.12 node/v4.3.1 win32 x64"

; userconfig C:\Users\username\.npmrc
https-proxy = "http://username:Password@host:port/"
proxy = "http://username:Password@host:port/"
python = "C:\\Python25"
strict-ssl = false

; builtin config undefined
prefix = "C:\\Users\\username\\AppData\\Roaming\\npm"

etc