holepunchto/hyperbee

SyntaxError: await is only valid in async functions and the top level bodies of modules

Closed this issue · 1 comments

I tried to install hyperbee and run the usage example (as it is). It returns me this error message:

$ node hyperbee-usage.js 
/home/user/hyperbee-usage.js:8
await db.put('key', 'value')
^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules
    at wrapSafe (node:internal/modules/cjs/loader:1024:16)
    at Module._compile (node:internal/modules/cjs/loader:1072:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47