Read about a proxy variable in a .npmrc
file but it does not work. Trying to avoid manually downloading all require packages and installing.
vim ~/.npmrc
in your Linux machine and add following. Don't forget to add registry
part as this cause failure in many cases.
proxy=http://<proxy-url>:<port>
https-proxy=https://<proxy-url>:<port>
registry=http://registry.npmjs.org/
A lot of applications (e.g. npm) can use proxy setting from user environment variables.
You can just add to your environment following variables HTTP_PROXY and HTTPS_PROXY that will have the same value for each one
http://user:password@proxyAddress:proxyPort
For example if you have Windows you can add proxy as follow:
There has been many answers above for this question, but none of those worked for me. All of them mentioned to add http://
prefix. So I added it too. All failed.
It finally works after I accidentally removed http://
prefix. Final config is like this:
npm config set registry http://registry.npmjs.org/
npm config set http-proxy ip:port
npm config set https-proxy ip:port
npm config set proxy ip:port
npm set strict-ssl false
I don't know the logic behind this, but it worked. If none of answers above works for you, maybe you can have a try on this way. Hope this one is useful.
This works for me in Windows:
npm config set proxy http://domain%5Cuser:pass@host:port
If you are not in any domain, use:
npm config set proxy http://user:pass@host:port
If your password contains special characters such as "
,@
,:
and so on, replace them by their URL encoded values. For example "
->%22
, @
->%40
, :
->%3A
. %5C
is used for the character \
.
This worked for me-
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
npm set strict-ssl=false
Though i set proxy with config, problem was not solved but after This one worked for me:
npm --https-proxy http://XX.AA.AA.BB:8080 install cordova-plugins
npm --proxy http://XX.AA.AA.BB:8080 install