【问题标题】:Error: "git" command line tool is not installed:错误:未安装“git”命令行工具:
【发布时间】:2014-03-03 17:19:29
【问题描述】:

我正在尝试:

cordova plugins add https://github.com/wildabeast/BarcodeScanner.git

但我得到了:

Error: "git" command line tool is not installed:
make sure it is accessible on your PATH.

那么我这样做:

npm install -g git 

而且好像是安装在这里的:

c:\Users\Phillip\AppData\Roaming\npm\node_modules\git

那么应该将它添加到我现有的路径中吗?

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program 文件 (x86)\通用文件\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program 文件 (x86)\Common Files\Roxio Shared\10.0\DLLShared\;c:\Program Files (x86)\通用文件\Roxio Shared\DLLShared\;C:\AdobeAIRSDK\bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files\Microsoft SQL 服务器\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL 服务器\110\Tools\Binn\;c:\Program Files\Microsoft SQL 服务器\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL 服务器\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Common 文件\Acronis\SnapAPI\;C:\Program Files\Microsoft\Web 平台 安装程序\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\nodejs\;C:\apache-ant\bin;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools;%JAVA_HOME%\bin;C: \AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\sdk\platform-tools;C:\AndroidDevelopmentKit\adt-bundle-windows-x86_64-20131030\sdk\tools

或者我应该添加除 c:\Users\Phillip\AppData\Roaming\npm\node_modules\git 以外的其他内容吗? 因为我在那里看不到可执行文件。

【问题讨论】:

  • npm install -g git为nodejs安装了Git模块,这是一个可以与git接口的Javascript扩展库。您需要安装实际的 Git 软件版本,即 msysgit,并将其路径放在您的 PATH 环境中。

标签: git


【解决方案1】:
npm install -g git

这将安装 NPM 包git(也称为node-git)。这与可用作命令行实用程序的 real Git 不同。以前的 NPM 包本质上是一个利用 Git 功能的 Node JS 模块。正如该项目所解释的,它本身也包含一些操作,但对于许多其他操作,它需要回退到命令行实用程序。

所以,你应该只安装真正的Git

【讨论】:

    【解决方案2】:

    您需要安装git 可执行文件。在此处查看如何从 Windows 部分安装它:git installationmsysgit

    【讨论】:

      【解决方案3】:

      开始菜单>系统属性>系统高级配置>环境变量。 转到系统变量并找到“路径”变量,单击“编辑”,然后转到值的末尾,分号 (;) 并粘贴您的 git 路径(我的是:C:\Program Files\Git\bin) .保存它就完成了。

      【讨论】:

        【解决方案4】:

        如果你已经安装了 git,你仍然遇到问题意味着我有两个解决方案 1.在EV中添加路径“C:\Program Files\Git\bin”和“C:\Program Files\Git\cmd”。重启机器。

        第二个解决方案是卸载并安装(https://git-scm.com/downloads) aagin 并执行第 1 步。

        【讨论】:

          【解决方案5】:

          我也遇到了同样的问题并尝试了上述所有解决方案,但我仍然遇到同样的问题,因为我检查了环境变量中的“路径”并发现它已经存在 (C:\Program Files\Git\cmd;)在路径中,我正在添加(C:\Program Files\Git\bin;)。所以它正在制造冲突。 然后我删除 (C:\Program Files\Git\cmd;) 并仅在我的路径中附加 (C:\Program Files\Git\bin;)。并关闭 cmd 并再次在同一目录上输入相同的添加插件命令,它就成功了!!

          【讨论】:

            猜你喜欢
            • 2013-10-15
            • 2017-04-30
            • 2020-03-23
            • 2019-03-02
            • 1970-01-01
            • 1970-01-01
            • 2013-10-04
            • 2014-01-16
            • 2012-03-08
            相关资源
            最近更新 更多