A tiny hint maybe: it looks like pouchdb uses es6 module syntax
https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb/src/pouchdb.js
and this is presumably compiled via babel - so the way that require works
might be funky. Dunno though. Either way, I'd see if PouchDB here is
actually an object with, say a "default" property whose value is the
PouchDB constructor. console.log will probably help you here.

Good luck!

--Josh

On Tue, Oct 23, 2018 at 3:57 PM Matias Salimbene <matias.salimb...@gmail.com>
wrote:

> Hello,
>
> I'm using pouchDB as a cdb for an app and I'm struggling to understand
> this error: *Uncaught TypeError: PouchDB is not a constructor*
> The declaration is as follows:
>
> var PouchDB = require("pouchdb");var db = new PouchDB("scr");
>
> I've read about how it may be related to types and that adding:
>
>  "@types/node": "^10.12.0",
>  "@types/pouchdb": "^6.3.2",
>
>
> to my package.json should help, but it isn't. I've tested on another
> simple .js file and works, but on my main app it isn't. Still, I don't
> understand why it wouldn't work. The pouch documentation is quite clear
> https://pouchdb.com/api.html#create_document. I should mention I'm
> running this on the context of an electron app, not in the browser.
>
> Any tip is greatly appreciated,
>
> Cheers, Matias.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/ba0ec025-ed76-491c-8e25-559051d07c3f%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/ba0ec025-ed76-491c-8e25-559051d07c3f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHL2YmphKJOffZG1gK3fT6%3DrSnscF-Ep3dpTgxkCZ0ssrtBqCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to