I need Tesseract in my project so first I used yarn add tesseract.js after that I used yarn add --dev @types/tesseract.js. When I try to use ng serve I get the following error:
ERROR in node_modules/tesseract.js/src/index.d.ts:98:60 - error TS2591: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
98 | CanvasRenderingContext2D | File | Blob | ImageData | Buffer;
Anyone knows how to fix this? Thanks in advance
I was able to resolve this issue by adding types: ["node"] to the compilerOptions in tsconfig.app.json file.
{
...
"compilerOptions": {
...
"types": ["node"] // <-- This should do the charm.
},
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With