npm install with proxy code example

Example 1: set yarn proxy

yarn config set proxy http://user:password@host:port
yarn config set https-proxy http://user:password@host:port

Example 2: setting proxy in npm

npm config set proxy http://username:password@host:port
npm config set https-proxy http://username:password@host:port

Example 3: npm install not workjing behind proxy

npm config set strict-ssl false

# Set npm to use http instead of https
npm config set registry "http://registry.npmjs.org/"

# install your package with below syntax, can leave out the
# username:password section if your proxy does not require
# you to authenticate. The "http://" part is very important
npm --proxy http://username:password@cacheaddress.com.br:80 install packagename

Example 4: set proxy for npm

proxy=http://username:password@host:port
https-proxy=http://username:password@host:port
https_proxy=http://username:password@host:port