shuaishuai
shuaishuai

Reputation: 51

PouchDB in an Electron app gives error "dbFactory is not a function"

levelup.js?006c:115Uncaught TypeError: dbFactory is not a function

This is my question. I use it in chrome, but it's ok. When I use it in electron (Vue2.0), the same, but give me this tip. Who can help me?

Upvotes: 3

Views: 183

Answers (2)

Igor Lemon Kozlovsky
Igor Lemon Kozlovsky

Reputation: 46

Try to use init PouchDB as

const PouchDB = require('electron').remote.require('pouchdb');

Upvotes: 0

another_user10293412
another_user10293412

Reputation: 699

I faced the same issue and couldn't resolve it. Here's some documentation: https://github.com/nolanlawson/hello-electron-with-pouchdb. The author says that an alternate solution is to use the browser version of pouchdb, which ultimately worked for me.

Example:

import PouchDB from 'pouchdb-browser'

const db = new PouchDB('testdb', {adapter: 'websql'});

Docs: https://pouchdb.com/adapters.html

Upvotes: 1

Related Questions