package.json proxy code example

Example 1: npm install behind proxy

npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy http://<username><password>@proxy-server-url>:<port>
npm config set https-proxy http://<username><password>@proxy-server-url>:<port>
npm install

Example 2: package json proxy

"proxy": "http://localhost:4000"

Example 3: cra proxy

# In your package.json add the following

"proxy": "http://localhost:3080"

Example 4: how to run node js with proxy

$ npm config set proxy http://localhost:3128
$ npm config set https-proxy http://localhost:3128