[英]Bower install - failed with ETIMEDOUT
當我運行bower install
,出現以下錯誤:
對https://bower.herokuapp.com/packages/jquery 的請求因 ETIMEDOUT 失敗,在 1.8 秒后重試
但是當我在 Chrome 的地址欄中運行相同的 URL 時,我得到了 json。 我不知道為什么當我使用 Windows 7 命令外殼bower install
時它會失敗。 我懷疑這與我工作場所的代理設置有關。
任何人?
嘗試編輯 .bowerrc
"proxy":"http://<host>:<port>",
"https-proxy":"http://<host>:<port>",
"strict-ssl": false
你有沒有試過像http_proxy='proxyserver' https_proxy='proxyserver' bower install?
(其中 proxyserver 是您的代理)
未配置代理時獲取與代理相關的錯誤:可能是npm
正在選擇代理。
從npm
config 中刪除 proxy 屬性並嘗試。 用:
npm config delete proxy
這解決了我的問題。
您需要在 .bowerrc 中為 bower 設置新的注冊表:
{
"registry": "https://registry.bower.io"
}
舊網址https://bower.herokuapp.com/不再可用。
在我的情況下(Win7),這個問題是通過為 bower 提供代理設置來解決的。
正如@Robert Moon 在他的回答中提到的,您可以將此設置放在 .bowerrc 文件中。
對於需要身份驗證的代理,您需要按如下方式提供:
http://domain\username:password@proxyserverurl:port
反斜杠特別棘手,因為它需要在 .bowerrc 文件中轉義
示例 .bowerrc:
{
"directory": "bower_components",
"proxy": "http://domain%5Cusername:password@proxyserverurl:port",
"https-proxy": "http://domain%5Cusername:password@proxyserverurl:port",
"no-proxy":"localserver.domain.com"
}
Bower 的官方文檔提到了代理設置:
https://bower.io/docs/config/#bowerrc-specification
我也遇到了同樣的錯誤。 以下步驟為我修復了錯誤:
npm config delete proxy
然后使用: npm config set proxy http://<host>:<port>
您可能還需要更改 git 的代理設置:
git config --global http.proxy http://<host>:<port>
現在按照Robert Moon 的描述編輯 .bowerrc 文件
"proxy":"http://<host>:<port>", "https-proxy":"http://<host>:<port>", "strict-ssl": false
生產服務器構建 bower 很好,但開發服務器沒有構建,它是用 ETIMEDOUT 停止的。 當我添加時,錯誤發生了:
“超時”:120000
進入.bowerrc。
來自頁面https://bower.io/docs/config/ 的信息幫助了我。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.