drudge / mongoose-findorcreate

Simple plugin for Mongoose which adds a findOrCreate method to models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find a declaration file for module 'mongoose-findorcreate'.

Arunps94 opened this issue · comments

TypeError: User.findOrCreate is not a function

Ya gotta require it lol

Ya gotta require it lol

did required it but still same error

Would need a little more to go on to help out here..

Did you install the module? Did you call .plugin() on your schema passing in the required module?

I am working with findOrCreate right now. I have installed with and followed documentations on how to implement it. I am still getting the "No declaration file" as well stated by the original post. Is it missing in the API file itself? I am using the latest version of the npm package and latest version of Node.js

try to require it with @Virsion, or find the package name in your node_modules, it should be like that,
const findOrCreate = require('mongoose-findorcreate@3.0.0');

Within your working directory,

  1. create a folder named "types".
  2. Within "types" folder create another folder named "mongoose-findorcreate".
  3. Now within "mongoose-findorcreate" folder create a file "index.d.ts" ( here .d.ts is extension) and within this file write "declare module 'mongoose-findorcreate';" and save it.
  4. Now after few seconds decleration warning should stop and the module will work fine.

A problem is popping up : TypeError: Cannot read properties of undefined (reading 'ES6')

Same Problem: TypeError: Cannot read properties of undefined (reading 'ES6')

A problem is popping up : TypeError: Cannot read properties of undefined (reading 'ES6')

Same Problem: TypeError: Cannot read properties of undefined (reading 'ES6')

I don't think that it's related to this module.
It's just a logic error (JS ES6) where you are trying to read properties of something which is undefined.
You can google it :)

I don't think that it's related to this module

but this error arises after downloading files respective to this module. Then i don't how can we say the problem is not related to this module

Try version 4.0.0

Try version 4.0.0

it worked thanks

Try version 4.0.0

I'm using version 4.0.0 but I still get an error

Try version 4.0.0

I'm using version 4.0.0 but I still get an error

#27 (comment)