Skip to content
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

Property 'Buffer' does not exist on type 'typeof globalThis'. #10415

Closed
kevit-amish-faldu opened this issue Jul 3, 2021 · 15 comments
Closed
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@kevit-amish-faldu
Copy link

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

@SFVII
Copy link

SFVII commented Jul 3, 2021

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

@SFVII
Copy link

SFVII commented Jul 3, 2021

For the moment try to use this npm install --save sfvii/mongoose

@ekow-mensah
Copy link

I tried using this i.e. "npm install --save sfvii/mongoose " and still ran into the same issue

@nickjtch
Copy link

nickjtch commented Jul 3, 2021

@SFVII thank you for this! It didn't work for me either.

Any updates regarding this issue?

@Markkop
Copy link

Markkop commented Jul 3, 2021

npm install --save sfvii/mongoose didn't work for me too. Is there any other possible workaround?

@nickjtch
Copy link

nickjtch commented Jul 3, 2021

Tried downgrading to previous versions. Still doesn't help.

@geordle
Copy link

geordle commented Jul 3, 2021

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

@ekow-mensah
Copy link

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

yes this works! thanks @geordle

@vkarpov15
Copy link
Collaborator

Fix is in 726ce8b.

As a workaround, add @types/node: "15.x" to your dependencies in package.json. See DefinitelyTyped/DefinitelyTyped#53669.

@vkarpov15 vkarpov15 added this to the 5.13.2 milestone Jul 3, 2021
@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label Jul 3, 2021
@SFVII
Copy link

SFVII commented Jul 4, 2021

Just put @types/node: "15.x" on last line of depencies of your package.json that will override the other. But be sure that is placed on the last line. If you want to use npm install --save sfvii/mongoose samethink on last line

@ejacevedo
Copy link

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

thanks, it works

@SubJunk
Copy link

SubJunk commented Jul 12, 2021

Can someone please clarify whether this is a problem with just that types project, or is mongoose incompatible with Node 16?

@vkarpov15
Copy link
Collaborator

@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.

@SubJunk
Copy link

SubJunk commented Jul 14, 2021

@vkarpov15 thanks for clarifying

@SerhiiShkv
Copy link

Still the same problem with node: "16.x" versions

@Automattic Automattic locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

No branches or pull requests

10 participants