tesseract.js-angular-app icon indicating copy to clipboard operation
tesseract.js-angular-app copied to clipboard

Angular 9.1 build error Cannot find name 'Buffer'

Open atecey opened this issue 4 years ago • 1 comments

I'm running angular 9.1 with Ivy switched on and I get the following error when building

ERROR in node_modules/tesseract.js/src/index.d.ts:104:60 - error TS2591: Cannot find name 'Buffer'. Do you need to install type definitions for node? Trynpm i @types/nodeand then addnode to the types field in your tsconfig.

Node types are installed and is in tsconfig.

atecey avatar Mar 30 '20 21:03 atecey

ng v10 added to tsconfig.app.json

"types": [
   "node"
]

and work fine :) tsconfig.app.json now:

{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": [
      "node"
    ]
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ],
  "exclude": [
    "src/test.ts",
    "src/**/*.spec.ts"
  ]
}

ziuniecki avatar Jul 16 '20 17:07 ziuniecki