Couchbase Lite with Ionic v2

I am building a mobile app using the Ionic Framework v2 but i’m having some trouble creating a local database with Couchbase Lite, as whenever I try to do it I get an error with the following message:

THIS DB {"dbName":"test","lastChange":0,"dbUrl":"","localServerUrl":""}
ERR init ReferenceError: cbl is not defined

When trying to acess the DB:

ReferenceError: URI is not defined

This happens by running the Ionic app on the browser (with ‘ionic serve’).

If we run the project on the Android Emulator, for instance, the error is somewhat different, but the message is still the same:

Error in Success callbackId: CBLite400389325 : ReferenceError: URI is not defined

We’re using this plugin, and you can find the code we’re using on this gist.

Any help with this? Or any other way to make this work?


Hi, I wouldn’t recommend using this plugin. The documentation is bad and it’s only maintained by one person. I was looking into it myself but it’s not stable enough to use in production. I’d suggest you have a look at pouchDB. We are using it in our Web, iOS & Android app and it works like a charm with SG. Also the library has a big following and the codebase is well documented.