# Can't use PouchDB with Ionic 2 RC1

**URL:** <https://forum.ionicframework.com/t/cant-use-pouchdb-with-ionic-2-rc1/68275>\
**Category:** ionic-v3\
**Created:** [October 26, 2016, 1:03pm UTC](https://forum.ionicframework.com/t/cant-use-pouchdb-with-ionic-2-rc1/68275 "2016-10-26T13:03:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emre3](https://avatars.discourse-cdn.com/v4/letter/e/46a35a/32.png) [@emre3](https://forum.ionicframework.com/u/emre3)\
**Post date:** [October 26, 2016, 1:03pm UTC](https://forum.ionicframework.com/t/cant-use-pouchdb-with-ionic-2-rc1/68275/1 "2016-10-26T13:03:15Z")

</div>

I follow [http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/](http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/) this tutorial but i get `require is not defined` error in Chrome. I read [https://github.com/driftyco/ionic/issues/8356](https://github.com/driftyco/ionic/issues/8356) that topic but i can’t get anywhere… The tutorial with Ionic Beta is working as expected but RC1 fails. Does it have to be sooo difficult to get each step in Ionic2? Is there a tutorial/clue to make a simple connection with PouchDB?

---

<div class="post-metadata">

**Author:** ![emre3](https://avatars.discourse-cdn.com/v4/letter/e/46a35a/32.png) [@emre3](https://forum.ionicframework.com/u/emre3)\
**Post date:** [October 27, 2016, 7:37am UTC](https://forum.ionicframework.com/t/cant-use-pouchdb-with-ionic-2-rc1/68275/2 "2016-10-27T07:37:52Z")

</div>

Solution:

I installed latest Ionic App Scripts build tools (which uses Webpack instead of Rollup) with this command:

`npm install @ionic/app-scripts@beta`

Then run `npm run build` to test the new build process. [Source topic](https://forum.ionicframework.com/t/help-us-test-webpack-support-in-ionic-2-app-scripts/67507)

And then imported PouchDB like this:

`import * as PouchDB from 'pouchdb';` // no need to use `require()` anymore 🙂

Then tried this in a simple class:

```
  private _db;
  private _record;
  ionViewDidLoad() { // WARNING: tutorial uses old "ionViewLoaded" which is not working anymore
    console.log('starting db');
    this._db = new PouchDB('birthday2');
    this._record = { name: 'emre' };
    this._db.post(this._record);
    console.log("record ok");
  }

```

And voila! Hope this helps someone 🙂

Note: I’ve also added typings of PouchDB, i’m not sure if it was necessary:

`typings install --global --save dt~pouchdb dt~pouchdb-adapter-websql dt~pouchdb-browser dt~pouchdb-core dt~pouchdb-http dt~pouchdb-mapreduce dt~pouchdb-node dt~pouchdb-replication`
