Bower install - failed with ETIMEDOUT

2019-01-17 03:51发布

问题:

When I run bower install, I get the following error:

Request to https://bower.herokuapp.com/packages/jquery failed with ETIMEDOUT, retrying in 1.8s

But when I run the same URL in the address bar of Chrome, I get the json. I don't know why it fails when I do bower install using Windows 7 command shell. I suspect it has got something to do with my workplace's proxy settings.

Anyone?

回答1:

Have you tried something like http_proxy='proxyserver' https_proxy='proxyserver' bower install? (where proxyserver is your proxy)



回答2:

Try edit .bowerrc

"proxy":"http://<host>:<port>",
"https-proxy":"http://<host>:<port>",
"strict-ssl": false


回答3:

Getting error related to proxy when no proxy is configured: May be npm is picking up proxy.

Delete the proxy attribute from npm config and try. Use:

npm config delete proxy

This solved my problem.



回答4:

You need to set the new registry for bower in .bowerrc:

{
  "registry": "https://registry.bower.io"
}

The old url https://bower.herokuapp.com/ is no more available.



回答5:

In my case (Win7), this problem was fixed by providing bower with the proxy settings.

As @Robert Moon mentioned in his answer, you can place this settings in the .bowerrc file.

For proxies that require authentication you will need to provide it as follows:

http://domain\username:password@proxyserverurl:port

The back slash is particularly tricky since it needs to be escaped in the .bowerrc file

Example .bowerrc:

{
  "directory": "bower_components",
  "proxy": "http://domain%5Cusername:password@proxyserverurl:port",
  "https-proxy": "http://domain%5Cusername:password@proxyserverurl:port",
  "no-proxy":"localserver.domain.com"
}

The official documentation from Bower that mentions proxy settings:
https://bower.io/docs/config/#bowerrc-specification



回答6:

I was also stuck with the same error. The following steps fixed the error for me:

  1. Remove any existing proxy: npm config delete proxy

Then set proxy using: npm config set proxy http://<host>:<port>

  1. You may also need to change the proxy settings for git:

    git config --global http.proxy http://<host>:<port>

  2. Now edit the .bowerrc file as described by Robert Moon

"proxy":"http://<host>:<port>", "https-proxy":"http://<host>:<port>", "strict-ssl": false