I am facing an issue that the mongoose returns an error likes
node_modules/mongoose/index.d.ts:1867:33 - error TS2339: Property 'Buffer' does not exist on type 'typeof globalThis'.
My NestJS is running properly under my development machine with below specification
Node version: v14.17.3
Base image when packaging docker image
Node version: v14.17.1
package.json
{
"dependencies": {
},
"devDependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/mongoose": "^7.2.4",
"mongoose": "^5.12.1"
}
}
I found a few solution like adding @types/node but it does not work in my case.
Go to package.json file. Change @types/node: "^16.0.0" to @types/node: "^15.6.1" and save it.
Then run npm install !!