fr00t
fr00t

Reputation: 679

Upgrade cordova: cannot install plugins from git urls anymore

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 (~/).

Upvotes: 24

Views: 11169

Answers (10)

MrJaid
MrJaid

Reputation: 89

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.

Upvotes: 1

Sundar Ram
Sundar Ram

Reputation: 1461

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.

Upvotes: 1

Linda Z
Linda Z

Reputation: 312

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

Upvotes: 1

Japheth Adhavan
Japheth Adhavan

Reputation: 101

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

Upgrade Cordova using npm install -g cordova

Upvotes: 5

dahook
dahook

Reputation: 39

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+"'");

Upvotes: 2

Ivan Bartsov
Ivan Bartsov

Reputation: 21056

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 [email protected] && cordova plugin add [plugin url] && npm install -g cordova

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

Upvotes: 4

Ganesan Murugesan
Ganesan Murugesan

Reputation: 145

sudo npm install -g [email protected]

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

Upvotes: 1

Pian0_M4n
Pian0_M4n

Reputation: 2548

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.

Upvotes: 26

hexin
hexin

Reputation: 29

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

Upvotes: 2

AMilassin
AMilassin

Reputation: 1196

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

Upvotes: 26

Related Questions