Cordova error: Using “requireCordovaModule” to load non-cordova module “q” is not supported

后端 未结 14 878
情深已故
情深已故 2020-12-08 12:59

I noticed that the builds on our CI started to fail because of the following error:

Discovered plugin \"cordova-plugin-app-version\" in config.xml. Adding it         


        
14条回答
  •  甜味超标
    2020-12-08 13:30

    As the error says, you need to require the q. Go to npmInstall.js (Search the requireCordovaModule in your project then you will see the npmInstall.js ).

    Then, add these lines;

    var q = require('q');
    var npmModule = require('npm');
    

    and replace: var Q = context.requireCordovaModule('q'); with

    var Q = context.q;
    

    and replace: var npm = context.requireCordovaModule('npm'); with

    var npm = context.npmModule;
    

提交回复
热议问题