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

后端 未结 14 841
情深已故
情深已故 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:16

    This is what worked for me: I removed cordova by calling

    npm uninstall cordova -g
    

    and then installed it globally again with

    npm install -g cordova@8.1.1
    
    0 讨论(0)
  • 2020-12-08 13:19

    Here's a little tip in finding where requireCordovaModule exists:

    For those looking to change requireCordovaModule to require, I have found it easy to search for the requireCordovaModule text right from the command line by using this command:

    grep -r 'requireCordovaModule' ./
    

    Then, you can drill into those files and rename the requireCordovaModule to require.

    0 讨论(0)
  • 2020-12-08 13:22

    remove cordova-plugin-crosswalk-webview

    0 讨论(0)
  • 2020-12-08 13:24

    I also get this error after updating to 9.0.0. In my case I fixed it doing a clean up and rebuilding my app. You can try the following steps.

    First of all

    1. Update Cordova: npm install -g cordova
    2. Update SDK, ex: ./android/tools/bin/sdkmanager "build-tools;28.0.3" "platforms;android-28"
    3. Add SDK path to your system (1), ex: in bashrc export ANDROID_SDK_ROOT=~/android

    (1) ANDROID_HOME is deprecated but still working

    In your Cordova Project

    1. Remove node_modules, platforms and plugins folders
    2. Remove package.json and package-lock.json
    3. Remove from config.xml plugins/platforms/engine
    4. Add your platform, ex: cordova platform add android
    5. Add your plugins updated, ex: cordova plugin add cordova-plugin-whitelist
    6. Build: cordova build

    You can check a resume of your app with: cordova info

    If you want to see a list of your plugin you can use: cordova plugins ls

    Hope this help or at least point someone to the right direction :)

    0 讨论(0)
  • 2020-12-08 13:25

    i can solve this issue by downgrading cordova to 8.1.1.

    npm remove cordova -g && npm install -g cordova@8.1.1
    
    0 讨论(0)
  • 2020-12-08 13:29

    This solution worked for me - https://github.com/xpbrew/cordova-sqlite-storage/issues/856#issuecomment-497298630

    For whatever plugin this error is associated with, run:

    cordova platform rm ios
    cordova platform rm android
    cordova plugin rm <package-name>
    
    npm i <package-name>@latest
    cordova plugin add <package-name>
    cordova platform add ios
    cordova platform add android
    

    edit: I recently discovered that running:

    cordova platform add ios && cordova platform add android
    

    would not install the most recent versions, would be nice for someone to explain why this is different to running them seperately, but this was my problem.

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