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