title: Ionic 4 with Sqlite - Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined
body: <p>My database is not getting created. When I see my console, it shows the following error:</p>
  
  <blockquote>
    <p>Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
    TypeError: Cannot read property 'then' of undefined
        at new HomePage (home.page.ts:31)</p>
  </blockquote>
  
  <p>I have installed <code>npm install @ionic-native/sqlite@beta --save</code></p>
  
  <p>Below is my <code>home.page.ts</code> code:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { NavController } from '@ionic/angular';
  import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
  
  @Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss'],
  })
  export class HomePage {
  constructor(public navCtrl: NavController,private sqlite: SQLite){
    this.sqlite.create({
      name: 'ionicdb.db',
      location: 'default'
    })
    .then((db: SQLiteObject) =&gt; {
      db.executeSql('CREATE TABLE IF NOT EXISTS expense2(rowid INTEGER PRIMARY KEY, date TEXT, type TEXT, description TEXT, amount INT)', [])
      .then(() =&gt; console.log('Executed SQL'))
      .catch(e =&gt; console.log(e, 'err'));
    })
    .catch(e =&gt; console.log(e)); 
  }
  }
  </code></pre>
  
  <p>I have done as per the documentation but dont know why this error is still there.</p>
  
  <p>My project's <code>ionic info -v</code> for your reference:</p>
  
  <pre><code>ionic (Ionic CLI)             : 4.8.0 (C:\Users\jessica\AppData\Roaming\npm\node_modules\ionic)
     Ionic Framework               : @ionic/angular 4.0.0-rc.1
     @angular-devkit/build-angular : 0.11.4
     @angular-devkit/schematics    : 7.1.4
     @angular/cli                  : 7.1.4
     @ionic/angular-toolkit        : 1.2.2
  
  Cordova:
  
     cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
     Cordova Platforms     : none
     Cordova Plugins       : no whitelisted plugins (2 plugins total)
  
  System:
  
   (C:\Program Files (x86)\Android\android-sdk)
     NodeJS            : v10.15.0 (C:\Program Files\nodejs\node.exe)
     npm               : 6.0.1
     OS                : Windows 8.1
  </code></pre>