2014-06-15 34 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]不是问题。