Ionic 5 Angular Sqlite: Uncaught in Promise

i dont know what am i doing wrong

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
TypeError: Cannot read property 'then' of undefined
import {Injectable} from '@angular/core';
import {Plugins} from "@capacitor/core";
import {IonRouterOutlet, Platform} from "@ionic/angular";

import {HttpClient, HttpHeaders} from '@angular/common/http';
import {BehaviorSubject, Observable} from 'rxjs';
import {SQLitePorter} from '@ionic-native/sqlite-porter/ngx';
import {SQLite, SQLiteObject} from '@ionic-native/sqlite/ngx';


@Injectable({
    providedIn: 'root'
})
export class UniversalService {
    private database: SQLiteObject;
    employeelist = new BehaviorSubject([]);
    private dbReady: BehaviorSubject<boolean> = new BehaviorSubject(false);

    constructor(
        private plt: Platform,
        private sqlite: SQLite,
        private sqlPorter: SQLitePorter,
    ) {
        this.plt.ready().then(() => {
            return this.createDB()
        });
    }

    createDB() {
        this.sqlite.create({
            name: 'emp.db',
            location: 'default'
        })
//////////////////////////////////////////////////////
GETTING ERROR HERE
//////////////////////////////////////////////////////
            .then((db: SQLiteObject) => {
                this.database = db;
                alert("created!!")
            })
            .catch(e => {
                alert("error " + JSON.stringify(e))
            });
    }
...

Welcome to the Ionic Community :tada:

This error usually indicates that a Cordova plugin wasn’t added correctly - try to remove and add the platform again, or simply add the plugin again, and then check if you see the files for the plugin included in your native project.

You can also find more information in my post about building an Ionic app with SQLite database.

Is it possible that the answer is “trying to run code that requires SQLite on a platform that doesn’t provide it”? This code needs to be run on a device, not in a PC browser.