apache / apache/pouchdb

Uncaught TypeError: PouchDB.defaults is not a function in ElectronJS Application [Electron React Boilerplate basically]

Open
#8,679 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue

@nolanlawson @daleharvey

I am using PouchDB in electron react boilerplate alongside of `pouch-db-server`, `pouchdb-find` & `pouchdb-size`. Until I was on node 14.16.0, the app was working perfectly fine 3 days ago. Now, the client has requested to upgrade the entire electron app, hence I upgraded `node.js` to `18.16.0`.

**I also upgraded electron, electron-rebuild, and webpack. FYI**

After I'm done with the yarn install and everything, I run yarn start after which, in the devTools, I see `Uncaught TypeError: PouchDB.defaults is not a function`

**please Take a look at the version of pouchdb I am using:**

![image](https://github.com/pouchdb/pouchdb/assets/110833246/605df5d5-2a31-4b6f-914d-97c56509a830)

**Some more libraries that are used to build native modules in electron & node.js & package app:**

electron-builder: ^24.2.1
@electron/rebuild: 3.2.12,
node-gyp@9.3.0

### Info
- Environment: Node.js 18.16.0
- Platform: Chromium 100+ (Electron 20.3.12)
- Adapter: levelDB
- Server: PouchDB server

### Reproduce

1. To reproduce this issue, just clone the electron boilerplate: https://github.com/electron-react-boilerplate/electron-react-boilerplate and install the pouchdb and other libraries mentioned in the screenshot above.
2. run yarn install and yarn start after that
3. in the devTools, you'll see the Uncaught TypeError: PouchDB.defaults is not a function

What do I think could be the issue?

- Webpack 5 (I recently migrated)
- node.js upgradation
- old pouch-db library

Yet, I couldn't come up with the root cause for the same.

![image](https://github.com/pouchdb/pouchdb/assets/110833246/745b417b-37a9-4144-8b36-32eff21a9d32)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.