2014-06-15 32 views
4

當使用node.js安裝PhoneGap時,出現上述錯誤。我以Admin身份運行Node.js命令提示符。下面是從錯誤日誌的完整列表:安裝PhoneGap得到「錯誤未找到:git」

370 error not found: git 
371 error Failed using git. 
371 error This is most likely not a problem with npm itself. 
371 error Please check if you have git installed and in your PATH. 
372 error System Windows_NT 6.2.9200 
373 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "phonegap" 
374 error cwd C:\Windows\System32 
375 error node -v v0.10.28 
376 error npm -v 1.4.9 
377 error code ENOGIT 
378 verbose exit [ 1, true ] 

我已經加入我的路徑git.exe到nodevars.bat文件,當我在Node.js的命令屏幕鍵入「混帳」,我得到用戶響應(證明git在路徑中)。

這是一個全新的機器,所以我可能忽略了一些東西,但我無法弄清楚什麼。

編輯:更多信息 - 我正在使用Windows 8.1,並使用「Node.js命令提示符」(窗口上的標題)。我是從這裏的操作說明:http://phonegap.com/install/

當我在提示符處鍵入我得到的git:
C:\ Windows \ System32下> git的 用法:混帳[--version] [--help] [ - c-name-value] [--exec-path [=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no- [--git-dir =] [--work-tree =] [--namespace =] []

+0

爲什麼在「node.js cmd screen」(你指的是節點REPL?)中使用Git?打開命令行(不是node.js之一)並在那裏輸入git,向我們顯示結果。 –

+0

不,我一定使用node.js命令屏幕。 (請參閱編輯)。 git命令由npm調用,我想。我很確定npm試圖使用git下載文件,並且出於某種原因,它在腳本內部失敗。 – richb01

+0

節點命令屏幕不會安裝任何東西,它只是演示代碼。你必須從命令行安裝它,即cmd.exe –

回答

10

重新啓動並嘗試重新啓動後,另外一件事,似乎npm腳本的某些部分沒有找到git。我打開Git Shell並從那裏運行命令。它已安裝。

+0

如何打開git shell? – Daniel

+1

@Daniel - 我在Windows 8.1(使用Classic Shell)上運行GiyHub 2.1.1。它在我的程序菜單中安裝了一個'GitHub,Inc'項目。在這之下是Git Shell的捷徑。另一個想法:嘗試「C:\用戶\ [你用戶] \ AppData \ Local \ GitHub \ GitHub.appref-ms」。這爲我打開了Git shell。 HTH! – richb01

+0

感謝它的工作 – Daniel

5

我有同樣的問題,但我安裝了以前的版本,它的工作。試試這個:npm install -g [email protected]

0

我可以在我的cygwin上安裝git之後安裝它。 cigwin/bin在我的PATH中,所以在Windows cmd上安裝[email protected]不是問題。