bower 软件包在 git/https 上的安装问题

bower 软件包在 git/https 上的安装问题

这是我的操作系统:(但通过 vagrant 使用 VM - Virtualbox 安装在我的笔记本电脑上)

Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise

我面临的问题是当我尝试这样做时:

bower install jquery

我收到此错误:

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

起初我怀疑我的机器无法访问 https,但是使用 wget 进行如下简单测试,我能够通过 https 从 URL 获得响应:

wget -qO- https://bower.herokuapp.com/packages/jquery

并得到以下响应:

{"name":"jquery","url":"git://github.com/components/jquery.git"}

经过网上一番查找,发现还有其他类似事件,可通过以下方式解决:

git config --global url."https://".insteadOf git://

但这对我来说不起作用,我不确定是否有其他方法可以使它工作,因为显然我的公司防火墙以某种方式阻止了这一点。

我的公司没有使用任何代理服务,所以我怀疑防火墙中的一些规则导致了这种情况,因为在公司网络之外使用同一台机器时我根本没有遇到这个问题。

我们公司的 IT 部门肯定不会为我做任何事情或以任何方式支持我,所以我只能向这里寻求建议或寻求解决办法。

[编辑]

我已进行更多测试,结果表明下列操作可行 [即使没有 git 配置来强制 git 使用 https]:

bower install jquery=http://bower.herokuapp.com/packages/jquery

但是为什么 bower 不能与 https 一起使用?因为我已经尝试执行 wget -qO-https://bower.herokuapp.com/packages/jquery并且我没有任何超时。

我还尝试更新 .bowerrc 以包含以下内容

{
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:22.0) Gecko/20100101 Firefox/22.0"
}

但我仍然遇到同样的问题,我还能做些什么吗?

答案1

该问题可能特定于网络环境,在我更新 bower package.json 以将其中一个依赖项从“request”:“~2.27.0”更改为“request”:“~2.33.0”后,我迄今为止的操作系统版本问题就消失了

检查 bower github repo,package.json 已使用最新的依赖项版本更新,但执行 npm install bower 时仍存在旧依赖项。因此,目前我正在手动更新文件 package.json。

答案2

你见过这样的解决方案吗:

bower 安装 git+https://路径/to/the.git

git+https 强制 git 使用 https 而不是默认端口。

相关内容