24

I did a cordova/phonegap upgrade and now I cannot install plugins from git urls anymore. Anyone experienced such an issue and already solved this?

$ cordova plugin add https://github.com/dawsonloudon/VideoPlayer.git
Fetching plugin "https://github.com/dawsonloudon/VideoPlayer.git" via git clone
Repository "https://github.com/dawsonloudon/VideoPlayer.git" checked out to git ref "master".
shell.js: internal error
Error: EXDEV, cross-device link not permitted '/var/folders/xl/bkl76rm570gfsmjspfjgh45h0000gn/T/git/1434106220728/LICENSE'
    at Object.fs.renameSync (fs.js:554:18)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/mv.js:77:8
    at Array.forEach (native)
    at Object._mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/mv.js:53:11)
    at Object.mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/src/common.js:186:23)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/plugins.js:53:19
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44

Version info:

$ phonegap -v
5.0.0-0.28.1

$ cordova -v
5.1.1

OSX 10.10.3

EDIT: It seems that it works if I move my repository to my home directory (~/).

fr00t
  • 681
  • 1
  • 4
  • 19

10 Answers10

26

I had the same issue with Cordova on Windows 7. I had to roll back to 5.0.0 (npm install -g cordova@5.0.0) to make it work again.

AMilassin
  • 1,176
  • 16
  • 23
26

A quick fix is to clone the git locally and provide the path from there. For a plug-in to start working, all it needs is to see the plugin.xml file

So cordova plugin add https://github.com/phonegap/phonegap-plugin-fast-canvas.git -- fails because

shell.js: internal error Error: EXDEV, cross-device link not permitted '/ -- normal error in Cordova 5.1.0+. Applies to most if not all .git install

Local clone :: git clone https://github.com/phonegap/phonegap-plugin-fast-canvas.git

And local install cordova plugin add /path/to/phonegap-plugin-fast-canvas

Works.

Pian0_M4n
  • 2,505
  • 31
  • 35
5

This issue is fixed in the latest cordova version(5.2.0).

Upgrade Cordova using npm install -g cordova

Japheth Adhavan
  • 101
  • 1
  • 6
4

To extend other great answers provided here,

As a temporary workaround, here's a one-liner that will downgrade Cordova, install plugin, and upgrade Cordova back:

npm install -g cordova@5.0.0 && cordova plugin add [plugin url] && npm install -g cordova

Will take some time to execute, but eliminates all the manual repo cloning work.

Ivan Bartsov
  • 19,664
  • 7
  • 61
  • 59
2

I had the same situation with you. and resvole this problem need to pull back the cordova to 5.0.0

hexin
  • 29
  • 1
2

The problem comes from node.js fs.rename() which is unable to rename files cross devices.

A possible workaround is to replace fs.renameSync() with something else in cordova/node_modules/cordova-lib/node_modules/shelljs/src/mv.js

Eg:

var run=require('sync-runner');
...
run("mv '"+src+"' '"+thisDest+"'");
Bruce
  • 1,647
  • 4
  • 20
  • 22
dahook
  • 39
  • 1
1

sudo npm install -g cordova@5.0.0

sudo cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git

1

Cordova 5.1.1 has a bug that can cause plugins installed from a Git repo to fail with the error "Error: EXDEV, cross-device link not permitted" if the project is on a different drive than your temp folder.

You can add plugins from npm. Or, if you must add a Git version of the plugin, you can instead download a copy, unzip it, and add the plugin from the file system by putting it in the config.xml and specifying the directory path in "spec": https://cordova.apache.org/docs/en/latest/config_ref/index.html#plugin

Linda Z
  • 312
  • 1
  • 5
1

I had the same issue and got it resolved by following the advice of AMilassin (rolling back to Cordova Version 5.0) . Another issue I had was my Git installation path (C:\Program Files\Git\bin) was not added to the Environment Variables. Once I fixed both issues, I was able to install the plugins I needed.

Sundar Ram
  • 1,371
  • 1
  • 8
  • 4
1

For anyone having same issue with cordova version 7.0.1 or later, solve mine by including a package.json file in my project base directory and ensuring the version in the package.json file is of the pattern X.X.X example 1.0.0 else you would get invalid version error.

MrJaid
  • 89
  • 6