Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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). 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. The Android SDK is working, and I have updated all of these modules and tried re-installing. Here is the error I receive when I try to install a plugin that is not part of Cordova core:

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. Your advice and guidance is greatly appreciated. Thanks!

like image 585
FugueWeb Avatar asked Apr 16 '14 22:04

FugueWeb


3 Answers

It seems there is a bug in git source dependencies on Windows.

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

EDIT

I removed the numerical extension, which is not needed, to follow the remark from FugueWeb

UPDATE (From Sept 2014)

As noted in Daren Beale's answer and also in the issue linked above, this bug is fixed in Git 1.9.4. Downloading the latest version of GIT for Windows should get around this problem.

like image 87
slaadvak Avatar answered Nov 12 '22 23:11

slaadvak


I had this exact issue on my desktop but not on my laptop, as suggested above it look like a Git issue. Installing the latest version of Git on my desktop (1.9.4) fixed the problem.

like image 7
Darren Beale Avatar answered Nov 12 '22 23:11

Darren Beale


I was experiencing a similar issue while issuing the commands from cygwin, cygwin's temp folder structure is a bit different

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)

like image 2
Kaan Soral Avatar answered Nov 12 '22 23:11

Kaan Soral