ionic-example icon indicating copy to clipboard operation
ionic-example copied to clipboard

Cannot read property 'openDatabase' of undefined Test in device

Open marzoukiniz opened this issue 6 years ago • 2 comments

Cannot read property 'openDatabase' of undefined TypeError TypeError: Cannot read property 'openDatabase' of undefined ) at CordovaDriver.createDatabaseConnection

marzoukiniz avatar Jan 17 '19 07:01 marzoukiniz

Same problem with me.

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'openDatabase' of undefined
TypeError: Cannot read property 'openDatabase' of undefined
    at vendor.js:168847
    at new t (polyfills.js:3)
    at CordovaDriver.createDatabaseConnection (vendor.js:168842)
    at CordovaDriver.<anonymous> (vendor.js:35867)
    at step (vendor.js:228)
    at Object.next (vendor.js:209)
    at vendor.js:202
    at new t (polyfills.js:3)
    at __awaiter (vendor.js:198)
    at CordovaDriver.AbstractSqliteDriver.connect (vendor.js:35861)
    at c (polyfills.js:3)
    at polyfills.js:3
    at polyfills.js:3
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (vendor.js:4446)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (vendor.js:4437)

ionic info:

Ionic:

   Ionic CLI          : 6.12.1 (/Users/user/.nvm/versions/node/v14.4.0/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.7.0
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.0.0
   Cordova Plugins   : no whitelisted plugins (5 plugins total)

Utility:

   cordova-res (update available: 0.15.2) : 0.15.1
   native-run (update available: 1.2.2)   : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/Users/user/Library/AndroidStudio/Android/sdk)
   ios-deploy        : 1.11.2
   NodeJS            : v14.4.0 (/Users/user/.nvm/versions/node/v14.4.0/bin/node)
   npm               : 6.14.5
   OS                : macOS Catalina
   Xcode             : Xcode 12.1 Build version 12A7403

willyguevara avatar Nov 17 '20 14:11 willyguevara

i solve my issues with the following steps using ionic 5

  1. Install the plugin
ionic cordova plugin add cordova-sqlite-storage --save
  1. Install TypeORM
npm install typeorm --save
  1. Install node.js-Types
npm install @types/node --save-dev
  1. Add "typeRoots": ["node_modules/@types"] to your tsconfig.json under compilerOptions
  2. Open tsconfig.app.json file and in compilerOptions --> types add "node" to the array

if you get runtime error global is undefined in my case in buffer module; edit file /node_modules/buffer/index.js and add at the top window.global = window;

willyguevara avatar Nov 26 '20 18:11 willyguevara