Running Ionic at cca throw “Cannot read property 'Keyboard' of undefined” @ app.js:14

前端 未结 3 1298
南笙
南笙 2021-01-18 10:21

The following is what I did to setup Ionic in Chrome App for Mobile:

  1. Created a Chrome App for Mobile project - cca create projectname
  2. Cr
相关标签:
3条回答
  • 2021-01-18 10:39

    When I tried to add the plugin on Mac OSX the plugin had a different name. You have to run this command in the project directory.

    cordova plugin add ionic-plugin-keyboard
    

    You can see the lib here: keyboard plugin

    0 讨论(0)
  • 2021-01-18 10:44

    It sounds like you're not running this as an actual build -- are you using CADT? Even if you're testing with CADT on a device you will still NOT get window.cordova.plugins. Once you build the project with cca build and then install the apk on a device then the window.cordova.plugins will be defined.

    Hatzlacha

    0 讨论(0)
  • 2021-01-18 10:46

    I started getting the same error after removing plugins directory (I had a hook that was adding the plugins as part of the add platform). There are 3 plugins that ionic adds for a new project. I did not have keyboard and console ones as part of my hook.

    Check that you have following cordova plugins:

    cordova plugin add ionic-plugin-keyboard
    cordova plugin add org.apache.cordova.console
    cordova plugin add org.apache.cordova.device
    

    Once I added missing plugins to the ones added by hook the error was gone.

    Also, if node_modules was removed, npm install will be needed.

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