即使使用代理集,也可以通过网络防火墙运行bower或npm - ETIMEDOUT

时间:2015-02-17 12:55:29

标签: npm bower http-proxy

我无法让bower或npm通过客户端的网络工作,我不确定我是否正确设置了代理设置。

我已经尝试过针对类似问题的答案的各种建议,但对我来说没有任何作用。我收到以下错误:

C:\myproj>bower search react
bower retry         Request to http://bower.herokuapp.com/packages/search/react
failed with ETIMEDOUT, retrying in 1.7s
bower retry         Request to http://bower.herokuapp.com/packages/search/react
failed with ETIMEDOUT, retrying in 3.6s
bower retry         Request to http://bower.herokuapp.com/packages/search/react
failed with ETIMEDOUT, retrying in 7.0s
bower retry         Request to http://bower.herokuapp.com/packages/search/react
failed with ETIMEDOUT, retrying in 14.6s

我可以通过浏览器轻松访问http://bower.herokuapp.com,它可以为我提供json回复。

我的.bowerrc文件(在域\用户名上使用'\\',因为它无法解析它):

{
    "directory": "Content/bower_components",
    "proxy": "http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080",
    "https-proxy": "http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080",
    "strict-ssl": false,
    "registry": "http://bower.herokuapp.com"
}

对于NPM它只是挂起:

C:\myproj>npm install grunt-cli
npm WARN package.json cl.clientappointment@1.0.0 No repository field.
npm WARN package.json cl.clientappointment@1.0.0 No README data
|

我的.gitconfig文件:

[url "http://"]
    insteadOf = git://
[http]
    proxy = http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080
[https]
    proxy = http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080

我的.npmrc文件:

proxy=http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080/
https-proxy=http://mydomain\\myuser:mypassword@nnnnn004.claims.local:8080/
strict-ssl=false

如果我连接到没有防火墙的其他网络,一切正常。 我不确定我是否在提供的代理字符串上正确输入了我的用户名/密码,或者我在其他地方错过了设置。

1 个答案:

答案 0 :(得分:1)

所以问题是我没有在NPM(.npmrc)和Bower(.bowerrc)使用的代理URL中转义特殊字符。

proxy=http://domain\user:password@proxy:8080" 

需要

proxy=http://domain%5Cuser:password@proxy:8080"