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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 15

Commits related to this issue

Most upvoted comments

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.