Upgrade cordova: cannot install plugins from git urls anymore

前端 未结 10 1538
眼角桃花
眼角桃花 2020-12-16 11:15

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          


        
相关标签:
10条回答
  • 2020-12-16 11:41

    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.

    0 讨论(0)
  • 2020-12-16 11:45

    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

    0 讨论(0)
  • 2020-12-16 11:47

    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+"'");
    
    0 讨论(0)
  • 2020-12-16 11:48

    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.

    0 讨论(0)
提交回复
热议问题