我有一个使用 Visual Studio 2015 IDE 开发的 Cordova 应用程序。为了管理库和依赖项,我尝试使用 NuGet。但看起来,NuGet 无法管理客户端脚本,即 CSS。所以我探索了 BOWER。我使用命令 npm installl -g bower
安装了 Bower,现在我可以访问所有 Bower 命令。
当我尝试添加 jQuery 和 jQuery Mobile 等依赖项时,它尝试获取但失败了。它给出的错误是,
PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\git
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\Bower.cmd" install --force-latest
bower retry Request to https://bower.herokuapp.com/packages/jquery-mobile failed with ECONNRESET, retrying in 1.5s
bower retry Request to https://bower.herokuapp.com/packages/jQuery failed with ECONNRESET, retrying in 1.4s
bower retry Request to https://bower.herokuapp.com/packages/jQuery failed with ECONNRESET, retrying in 3.0s
bower retry Request to https://bower.herokuapp.com/packages/jquery-mobile failed with ECONNRESET, retrying in 3.1s
bower retry Request to https://bower.herokuapp.com/packages/jQuery failed with ECONNRESET, retrying in 4.8s
bower retry Request to https://bower.herokuapp.com/packages/jquery-mobile failed with ECONNRESET, retrying in 7.0s
bower retry Request to https://bower.herokuapp.com/packages/jQuery failed with ECONNRESET, retrying in 9.7s
bower retry Request to https://bower.herokuapp.com/packages/jquery-mobile failed with ECONNRESET, retrying in 8.5s
bower retry Request to https://bower.herokuapp.com/packages/jQuery failed with ECONNRESET, retrying in 26.5s
bower retry Request to https://bower.herokuapp.com/packages/jquery-mobile failed with ECONNRESET, retrying in 25.6s
bower jQuery#* ECONNRESET Request to https://bower.herokuapp.com/packages/jQuery failed: tunneling socket could not be established, cause=connect ETIMEDOUT
====Executing command 'npm install'====
npm WARN package.json WellnessAdvisor@1.0.0 No description
npm WARN package.json WellnessAdvisor@1.0.0 No repository field.
npm WARN package.json WellnessAdvisor@1.0.0 No README data
====npm command completed with exit code 0====
我浏览了一下,据说要设置代理之类的,
http_proxy = http://<user>:<password>@<your company proxy>:<port>
https_proxy= http://<user>:<password>@<your company proxy>:<port>
或者创建一个名为 .bowerrc 的文件并放置代码来克服代理。
{
"directory": "library",
"registry": "http://bower.herokuapp.com",
"proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/",
"https-proxy":"http://<USERNAME>:<PASSWORD>@<PROXY_IP>:<PROXY_PORT>/"
}
但没有任何效果。现在我尝试使用没有代理的开放网络,我得到了同样的错误。我是否遗漏了任何基本步骤?
我也试过从命令提示符窗口。遇到同样的错误。
最佳答案
感谢您的支持。其实我找到了原因。尽管我不在我的公司代理之下,但在环境变量中设置了一个属性。这意味着代理,即使我在一个开放的网络下。不知道是哪个软件进入了环境变量。我删除了它,现在可以使用了。
关于node.js - 无法安装 Bower 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34943403/