SyntaxError: Unexpected token function – Async Await Nodejs

Async functions are not supported by Node versions older than version 7.6.

You’ll need to transpile your code (e.g. using Babel) to a version of JS that Node understands if you are using an older version.

That said, versions of Node.js which don’t support async functions are now all past End Of Life and are unsupported, so if you are using an earlier version you should very strongly consider upgrading.

Leave a Comment