cancerberoSgx / camera-capture

Portable, fast camera capture library for node.js (server). TypeScript/JavaScript easy to use APIs. Uses puppeteer headless browser to capture webcam video (audio/desktop, recording, etc) and stream back to node.js frame by frame in plain image data for optimal speed or optionally encoded as jpeg, png, bmp, etc
MIT License
32 stars 8 forks source link

Cannot find name surface & await error messages #7

Open philippos86 opened 4 years ago

philippos86 commented 4 years ago

I'm on Mac, and trying to execute the first example on the homepage. However, I am receiving the following errors:

  1. Cannot find name surface.

  2. Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.ts(1378)

I'm sorry if my issue is trivial, but I'm quite new to typescript. How to solve these error messages?

philippos86 commented 4 years ago
  1. Cannot find name surface.

I resolved this problem based on the answers to the following question: TypeScript getting error TS2304: cannot find name ' require' by adding the following line at the top of my file: declare var surface: any; (I am not sure if this correct or not, but it took away the error message)

Now still have the await problem ...

MaxUint commented 1 year ago

it is as it is descrbied, you can not await in the top level of the scope. either wrap everything inside an async function or do not await the function calls