2016-01-22 144 views
5

我有一個使用Visual Studio 2015 IDE開發的Cordova應用程序。爲了管理庫和依賴項,我嘗試使用NuGet。但看起來,NuGet無法管理客戶端腳本,即CSS。所以我探索了BOWER。我使用命令npm installl -g bower安裝了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 [email protected] No description 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] 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>/" 
} 

但沒有任何工作。現在我嘗試使用無代理的開放式網絡,我遇到了同樣的錯誤。我錯過了任何基本步驟嗎?

我也嘗試從命令提示窗口。有同樣的錯誤。

+0

您是否可以通過瀏覽器訪問https://bower.herokuapp.com/packages? – Shuping

+0

是的,我可以從瀏覽器訪問它。 URL ** https://bower.herokuapp.com/packages/jQuery**給了我一個響應'{「name」:「jQuery」,「url」:「git://github.com/jquery/jquery。 git「,」hits「:47370}' – Joseph

+0

嘗試重新安裝NodeJs,Cordova和Bower。但不能說得對。任何人都可以分享他們的想法,這有助於我解決問題。實驗了許多線程和博客,但沒有運氣 – Joseph

回答

1

你是否已經嘗試從https更改Git協議通過執行與git:

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

感謝您的支持。我其實找到了原因。儘管我不在我的公司代理之下,但在環境變量中設置了一個屬性。這意味着代理甚至 - 雖然我在一個開放的網絡。不知道哪個軟件在環境變量中創建了條目。我刪除了它,現在它工作。

+0

如何調用這個變量?你剛刪除它?或其他人。因爲我有同樣的問題。 –