Solvedmongoose 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?
image

If the current behavior is a bug, please provide the steps to reproduce.

steps to reproduce issue

  1. Create a test folder
  2. Run "npm init"
  3. Run "npm i mongoose"
  4. Run "npm i typescript@latest --save-dev"
  5. Create a test.ts file and only import mongoose
  6. 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

16 Answers

✔️Accepted Answer

Think explicitly adding @types/node should work as a temp workaround. npm i --save-dev @types/node@^14.0.0.

Other Answers:

I just send pull request #10417 i think that will fix your problem