I need to download several packages through npm but our corporate proxy configuration is a .pac file (i'm on windows)
I have already tried
npm config set proxy http://mydomain\username:password@1.2.3.4:8181/proxy.pac
npm config set https-proxy http://mydomain\username:password@1.2.3.4:8181/proxy.pac
or
npm config set proxy http://1.2.3.4:8181/proxy.pac
npm config set https-proxy http://1.2.3.4:8181/proxy.pac
but it doesn't work...
any suggestion? thanks
I had run into several issues with this and finally what I did is as follows:
In fiddler custom rules, i added
Finally in npm i set the proxy to http://localhost:8888
This worked fine.
Look for the url of the
pac
file in internet explorer lan settings and download the pac file from the URL configured. The pac file is just a javascript file with a function namedFindProxyForURL
which returns different proxy hosts in different scenarios.Try to find a host in that pac file which you think is for general web traffic and plug it into .npmrc in
C:\Users\<username>\.npmrc
Even though you may login with your domain and username on your corporate machine, It is highly possible that the user active directory domain name is not required for the proxy, only the username and password (which may be different than your Active Directory login)
Don't forget to fiddle with escaping special password characters.
Download your
.pac
file. Open it in any editor and look forPROXY = "PROXY X.X.X.X:80;
. You may have many proxies, copy any of them and run the following terminal commands:Now you should be able to install any package!
I solved this problem this way:
1) I run this command:
npm config set strict-ssl false
2) Then set npm to run with http, instead of https:
npm config set registry "http://registry.npmjs.org/"
3) Then install your package
npm install <package name>
I ran into similar issue and found out that my npm config file ( .npmrc) is having wrong registry entry. commented it out and re ran npm install. it worked.
Try this, it was the only that worked for me:
npm --proxy http://:@proxyhost: --https-proxy http://:@proxyhost: --strict-ssl false install -g package
Pay atention to the option --strict-ssl false
Good luck.