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

You can use an IIFE here (Read more about it here)

(async function main () {
    // You can use await inside this function block
})();

Leave a Comment