Getting error TS2304: Cannot find name 'Buffer'

后端 未结 5 1604
Happy的楠姐
Happy的楠姐 2020-12-08 06:38

I am trying to do base64 encode in NodeJS using TypeScript.

Following code working fine in JavaScript.

When I am writing same thing in TypeScript and compil

5条回答
  •  一整个雨季
    2020-12-08 07:37

    For Angular users:

    1. Run the following command

    npm install --save @types/node

    1. In your tsconfig.app.json file, add these two lines to the CompilerOptions:
    "compilerOptions": {
        //...
        "types": ["node"],
        "typeRoots": ["node_modules/@types"]
      }
    

提交回复
热议问题