问题描述
我需要通过npm下载多个软件包,但我们的公司代理配置是.pac文件(我在Windows上)
我已经尝试过
npm config set proxy http://mydomain\username:[email protected]:8181/proxy.pac
npm config set https-proxy http://mydomain\username:[email protected]:8181/proxy.pac
或
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
但是它不起作用...
有什么建议吗?谢谢我刚刚遇到了一个非常相似的问题,即我无法让npm在我们的代理服务器后面工作.
我的用户名的格式为域\用户名"-代理配置中的斜杠导致出现正斜杠.所以输入这个:
npm config set proxy "http://domain\username:password@servername:port/"
然后运行此npm config get proxy
将返回以下内容: http://域/用户名:密码@服务器名:端口/
因此,为了解决该问题,我改用URL编码了反斜杠,因此输入以下内容:
npm config set proxy "http://domain%5Cusername:password@servername:port/"
并且与此相关的代理访问是固定的.
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:[email protected]:8181/proxy.pac
npm config set https-proxy http://mydomain\username:[email protected]: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've just had a very similar problem, where I couldn't get npm to work behind our proxy server.
My username is of the form "domain\username" - including the slash in the proxy configuration resulted in a forward slash appearing. So entering this:
npm config set proxy "http://domain\username:password@servername:port/"
then running this npm config get proxy
returns this:http://domain/username:password@servername:port/
Therefore to fix the problem I instead URL encoded the backslash, so entered this:
npm config set proxy "http://domain%5Cusername:password@servername:port/"
and with this the proxy access was fixed.
这篇关于在公司代理.pac后面使用npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!