mongoose: Property 'Buffer' does not exist on type 'typeof globalThis'.
Do you want to request a feature or report a bug? Bug
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
steps to reproduce issue
- Create a test folder
- Run “npm init”
- Run “npm i mongoose”
- Run “npm i typescript@latest --save-dev”
- Create a test.ts file and only import mongoose
- Run “tsc test.ts” in terminal
What is the expected behavior? Compile without any errors
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version. Node.js version - v16.4.1 Mongoose version - v5.13.1 MongoDb version - v4.4.6
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 15
Commits related to this issue
- Fix mongoose incompatibility with @types/node@16 See https://github.com/Automattic/mongoose/issues/10415#issuecomment-878651581 — committed to UniversalMediaServer/api by SubJunk 3 years ago
Think explicitly adding
@types/node
should work as a temp workaround.npm i --save-dev @types/node@^14.0.0
.I just send pull request https://github.com/Automattic/mongoose/pull/10417 i think that will fix your problem
I tried using this i.e. "npm install --save sfvii/mongoose " and still ran into the same issue
@SubJunk the issue is with the types project, they introduced a sizable breaking change that has nothing to do with the Node.js runtime. Mongoose supports Node v16.