Skip to content

(BUG) Cannot find module 'mongoose' or its corresponding type declarations. #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jake-ruth-qm opened this issue Oct 30, 2021 · 5 comments

Comments

@jake-ruth-qm
Copy link

When trying to compile typescript, I get this error:

Cannot find module 'mongoose' or its corresponding type declarations.

I tried rm -rf node_modules, package-lock.json, as well clean installing with yarn to see if that fixed it but no luck.

For now, I am just adding mongoose as a dev dep in my root package.json but I'd like if there is a solution for this.

I'm using the latest version (0.5.2) and tried downgrading as well. Still no luck.

@aymswick
Copy link

Bumping here as I ran into the issue as well, is this project still maintained? It seems mongoose should either be added to the package dependencies or the import removed

@lorensr
Copy link
Member

lorensr commented Mar 31, 2022

Thanks for reporting! Seems a shame to move from devDep to dep for a compile-time thing, but I don't know of a better solution. Should be fixed in 0.5.3.

I don't have much time these days, but intend to continue reviewing PRs.

@crccheck
Copy link

crccheck commented Mar 31, 2022

hah, of course you can't have it both ways. I found that 0.5.3 is introducing a second vestigial mongoose@^5.13.8 dependency in my package in addition to my [email protected]. I abandoned TypeScript so I don't have a solution for the original problem. Perhaps a peer dependency or optional dependency instead?

@tubbo
Copy link
Contributor

tubbo commented Mar 31, 2022

@lorensr I'm also having problems upgrading to the latest patch release, it broke my TypeScript build because it's trying to install a higher version of Mongoose. Since Mongoose isn't actually used in the implementation code, I'm not sure why it was added to dependencies. I can see it being used in tests, but those files aren't included into the build so I'm not sure why this was considered a "bug". It seems to be unrelated to the packaged code from apollo-datasource-mongodb.

@lorensr
Copy link
Member

lorensr commented Apr 3, 2022

Makes sense, sorry about that! Moved it to a peer dep in 0.5.4—does that work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants