Top-level ‘await’ expressions are only allowed when the ‘module’ option is set to ‘esnext’

You can wrap your code for const account inside an async function as your target option doesn’t support top level await.

 const account = async () => {
        await stripe.accounts.create({
          type: "express",
  });
};

It depends on your code whether you want to return something or you want to perform some other tasks after await.

Incase if you want to use top level await, More about using top level await is on https://stackoverflow.com/a/56590390/9423152

This it just a workaround of the problem not the exact solution as referred by other users.
Furthermore,
You can try changing the module option and target in tsconfig file if you are using Typescript on node.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)