cordova-plugin-crypt-file - requireCordovaModule error

后端 未结 3 1393
花落未央
花落未央 2021-01-12 14:18

I just upgrade Cordova to version 9. It cased plugin cordova-plugin-crypt-file to stop working - when I build the application, I get error

Using \"requireCor         


        
相关标签:
3条回答
  • 2021-01-12 15:09

    This fix works for me on Cordova 9.0, cordova-ios:

    In file:

    cordova-plugin-crypt-file/hooks/after_prepare.js

    , replace:

    var path              = context.requireCordovaModule('path'),
        fs                = context.requireCordovaModule('fs'),
        crypto            = context.requireCordovaModule('crypto'),
        Q                 = context.requireCordovaModule('q'),
        cordova_util      = context.requireCordovaModule('cordova-lib/src/cordova/util'),
        platforms         = context.requireCordovaModule('cordova-lib/src/platforms/platforms'),
        Parser            = context.requireCordovaModule('cordova-lib/src/cordova/metadata/parser'),
        ParserHelper      = context.requireCordovaModule('cordova-lib/src/cordova/metadata/parserhelper/ParserHelper'),
        ConfigParser      = context.requireCordovaModule('cordova-common').ConfigParser; 
    

    with:

    var path              = require('path'),
        fs                = require('fs'),
        crypto            = require('crypto'),
        Q                 = require('q'),
        cordova_util      = context.requireCordovaModule('cordova-lib/src/cordova/util'),
        platforms         = context.requireCordovaModule('cordova-lib/src/platforms/platforms'),
        ConfigParser      = context.requireCordovaModule('cordova-common').ConfigParser;
    

    Then remove the generated "ios" platform folder and re-add the "ios" platform again.

    0 讨论(0)
  • 2021-01-12 15:10

    Please use the following plugin:

    https://github.com/PeterHdd/cordova-plugin-crypto-file

    It is based on the cordova-plugin-crypt-file.

    The above plugin was made to work with cordova-plugin-ionic-webview, I have updated the plugin and now it works with cordova 9, so there is no need to downgrade.

    To install it do the following:

    npm i cordova-plugin-crypto-file@latest
    

    latest version 1.4.0 fixes the cordova 9 issue.

    0 讨论(0)
  • 2021-01-12 15:18

    I had the same problem. You need to downgrade cordova to the version 8.1.2

    npm uninstall -g cordova
    npm cache clean --force
    npm i -g cordova@8.1.2
    
    0 讨论(0)
提交回复
热议问题