简体   繁体   English

无法在CLI上从Git安装Cordova插件

[英]Can't install Cordova plugins from Git on CLI

I have been racking my brain on this for a while now. 我已经在这一段时间里绞尽脑汁待我了。 I am developing an Android app on Windows 7 in Cordova 3.4 and I can't get any of the non-core plugins to install (like Google Analytics , Social Share ). 我正在使用Cordova 3.4Windows 7上开发Android应用程序,但我无法安装任何非核心插件(如Google AnalyticsSocial Share )。 I know that I have plugman, node, git, cordova, and the CLI installed because when I type them into a command prompt I get back a valid response. 我知道我安装了plugman,node,git,cordova和CLI,因为当我在命令提示符下输入它时,我会得到一个有效的响应。 The Android SDK is working, and I have updated all of these modules and tried re-installing. Android SDK正在运行,我已经更新了所有这些模块,并尝试重新安装。 Here is the error I receive when I try to install a plugin that is not part of Cordova core: 以下是我尝试安装不属于Cordova核心的插件时收到的错误:

C:\Users\UserName\Desktop\hello>cordova plugin add https://github.com/danwilson/google-analytics-plugin.git
Fetching plugin "https://github.com/danwilson/google-analytics-plugin.git" via git clone
Error: Command failed: fatal: could not create work tree dir 'C:\Users\DAVIDH~1\AppData\Local\Temp\plugman\git\1397683376354'.: No such file or directory

I'm wondering if this is a PATH issue or not, though I have tried many solutions related to this. 我想知道这是否是一个PATH问题,尽管我已经尝试了许多与此相关的解决方案。 Your advice and guidance is greatly appreciated. 非常感谢您的建议和指导。 Thanks! 谢谢!

It seems there is a bug in git source dependencies on Windows. 似乎在Windows上的git源依赖项中存在一个错误。

Try to create the directory manually : 尝试手动创建目录:

mkdir C:\Users\DAVIDH~1\AppData\Local\Temp\plugman\git

Then : 然后 :

git clone https://github.com/danwilson/google-analytics-plugin.git

From there : https://github.com/sbt/sbt/issues/895 从那里: https//github.com/sbt/sbt/issues/895

EDIT 编辑

I removed the numerical extension, which is not needed, to follow the remark from FugueWeb 我删除了不需要的数字扩展,以遵循FugueWeb的评论

UPDATE (From Sept 2014) 更新(2014年9月起)

As noted in Daren Beale's answer and also in the issue linked above, this bug is fixed in Git 1.9.4. 正如Daren Beale的回答以及上面链接的问题所述,这个错误在Git 1.9.4中得到修复。 Downloading the latest version of GIT for Windows should get around this problem. 下载最新版本的GIT for Windows应该可以解决这个问题。

I had this exact issue on my desktop but not on my laptop, as suggested above it look like a Git issue. 我在桌面上遇到了这个确切的问题,但我的笔记本电脑上没有这个问题,如上所述,它看起来像是一个Git问题。 Installing the latest version of Git on my desktop (1.9.4) fixed the problem. 在我的桌面上安装最新版本的Git(1.9.4)解决了这个问题。

I was experiencing a similar issue while issuing the commands from cygwin, cygwin's temp folder structure is a bit different 我在从cygwin发出命令时遇到了类似的问题,cygwin的temp文件夹结构有点不同

Manually creating the parent folders (plugman and git), which doesn't exist, fixes the issue (the numbered folders can be created under the plugman/git folders later on) 手动创建不存在的父文件夹(plugman和git)修复了问题(稍后可以在plugman / git文件夹下创建编号的文件夹)

On my machine the issue was, that git wasn't available in the cmd in windows. 在我的机器上问题是,git在Windows中的cmd中不可用。 Open cmd and type "git" and press enter. 打开cmd并输入“git”并按Enter键。 If there is shown, that the command is not available, then you might have the same issue. 如果显示该命令不可用,则可能存在相同的问题。

Solution: 解:

Find out where your git.exe is located. 找出你的git.exe所在的位置。 For me it was a custom path in "D:\\Program Files\\Git\\bin". 对我来说,它是“D:\\ Program Files \\ Git \\ bin”中的自定义路径。 Then search in windows for "environment variables" and open the link to the shown windows settings. 然后在Windows中搜索“环境变量”并打开指向所显示窗口设置的链接。

Find the entry "Path" and click on "edit". 找到条目“路径”,然后单击“编辑”。 Add the path to the git.exe file (without "git.exe"). 添加git.exe文件的路径(不带“git.exe”)。 Restart cmd and type "git". 重新启动cmd并输入“git”。

If that was the only issue the installation of cordova plugins over git should work. 如果这是唯一的问题,通过git安装cordova插件应该可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM