# Ionic 3.6.0 and PouchDB / SQLite

**URL:** <https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442>\
**Category:** ionic-v3\
**Created:** [August 9, 2017, 4:15pm UTC](https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442 "2017-08-09T16:15:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunedam](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@lunedam](https://forum.ionicframework.com/u/lunedam)\
**Post date:** [August 9, 2017, 4:15pm UTC](https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442/1 "2017-08-09T16:15:46Z")

</div>

Hi.

Does anyone know of a working solution for Ionic@3.6?

> cli packages: (/Users/mr/workspace/my-app/node\_modules)
> 
> ```
> @ionic/cli-plugin-cordova : 1.6.2
> @ionic/cli-plugin-ionic-angular : 1.4.1
> @ionic/cli-utils : 1.7.0
> ionic (Ionic CLI) : 3.7.0
> 
> ```
> 
> global packages:
> 
> ```
> Cordova CLI : 7.0.1
> 
> ```
> 
> local packages:
> 
> ```
> @ionic/app-scripts : 2.1.3
> Cordova Platforms : android 6.2.3 ios 4.3.1
> Ionic Framework : ionic-angular 3.6.0
> 
> ```
> 
> System:
> 
> ```
> Android SDK Tools : 26.0.2
> Node : v6.11.2
> OS : macOS Sierra
> Xcode : Xcode 8.3.3 Build version 8E3004b
> ios-deploy : 1.9.1
> ios-sim : 5.0.13
> npm : 5.3.0 
> 
> ```

The version info from package.json:

> “cordova-plugin-sqlite-2”: “^1.0.4”,  
> “pouchdb”: “6.3.4”,  
> “pouchdb-adapter-cordova-sqlite”: “2.0.2”,

I want to use sqlite for storing my data on the device so that I can pre-populate it, so have done what I’ve done before:

> import PouchDB from ‘pouchdb’;  
> declare var require: any;

Then in my method …

> PouchDB.plugin(require(‘pouchdb-adapter-cordova-sqlite’));  
> this.db = new PouchDB(‘mydb’, { adapter: ‘cordova-sqlite’ });

This just fails now, when it used to be fine:

> TypeError: WebSqlPouchCore.call is not a function  
> at PouchDB$5.CordovaSQLitePouch (file:///android\_asset/www/build/vendor.js:138430:19)  
> at new PouchDB$5 (file:///android\_asset/www/build/vendor.js:127989:36)  
> at file:///android\_asset/www/build/main.js:1634:36  
> at t.invoke (file:///android\_asset/www/build/polyfills.js:3:9283)  
> at Object.onInvoke (file:///android\_asset/www/build/vendor.js:4508:37)  
> at t.invoke (file:///android\_asset/www/build/polyfills.js:3:9223)  
> at r.run (file:///android\_asset/www/build/polyfills.js:3:4452)  
> at file:///android\_asset/www/build/polyfills.js:3:14076  
> at t.invokeTask (file:///android\_asset/www/build/polyfills.js:3:9967)  
> at Object.onInvokeTask (file:///android\_asset/www/build/vendor.js:4499:37)

I’ve tried the suggested workarounds and fixes from [this topic](https://forum.ionicframework.com/t/update-to-3-5-3-and-pouchdb/98724), but all to no avail. If anyone has any working solution or thoughts I’d be very grateful.

---

<div class="post-metadata">

**Author:** ![lunedam](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@lunedam](https://forum.ionicframework.com/u/lunedam)\
**Post date:** [August 10, 2017, 12:10pm UTC](https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442/2 "2017-08-10T12:10:25Z")

</div>

I couldn’t get this to work with Ionic 3.6.0 (not clever enough), but have got it working with 3.5.3 and the following:

> “dependencies”:{  
> …  
> “cordova-plugin-sqlite-2”: “^1.0.4”,  
> “ionic-angular”: “3.5.3”,  
> “pouchdb”: “6.3.4”,  
> “pouchdb-adapter-cordova-sqlite”: “2.0.2”,  
> …  
> }  
> “devDependencies”: {  
> “@ionic/app-scripts”: “2.0.1”,  
> “@ionic/cli-plugin-cordova”: “1.4.0”,  
> “@ionic/cli-plugin-ionic-angular”: “1.3.1”,  
> “typescript”: “2.3.4”  
> },

I also switched back to version 3.5.0 of the Ionic CLI…

So. I didn’t need any of the websql plugins or individual pouchdb modules as per [this topic](https://forum.ionicframework.com/t/update-to-3-5-3-and-pouchdb/98724), but probably the dev dependencies from that topic were the clincher. However, I’ll freely admit I have no idea what fixed what, what broke what or why. I suspect that it’s to do with the latest Ionic app-scripts version somehow.

I hope that later versions of PouchDB and Ionic start playing together (I’m sure they will), but in the meantime I’m OK sticking with Ionic 3.5.3 for this current project.

---

<div class="post-metadata">

**Author:** ![hotentic](https://avatars.discourse-cdn.com/v4/letter/h/94ad74/32.png) [@hotentic](https://forum.ionicframework.com/u/hotentic)\
**Post date:** [October 4, 2017, 7:17pm UTC](https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442/3 "2017-10-04T19:17:42Z")

</div>

Hi,  
This doesn’t seem to be related to Ionic in the end.  
The root cause has been identified & fixed in the pouchdb adapter sqlite repo : [https://github.com/pouchdb-community/pouchdb-adapter-cordova-sqlite/issues/78](https://github.com/pouchdb-community/pouchdb-adapter-cordova-sqlite/issues/78)

So you can fix the issue by patching the lib/index.js file in your node\_modules/pouchdb-adapter-cordova-sqlite, until the fix is released.

HTH

---

<div class="post-metadata">

**Author:** ![lunedam](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@lunedam](https://forum.ionicframework.com/u/lunedam)\
**Post date:** [October 4, 2017, 7:51pm UTC](https://forum.ionicframework.com/t/ionic-3-6-0-and-pouchdb-sqlite/101442/4 "2017-10-04T19:51:08Z")

</div>

Thanks for letting me know. Appreciated.
