Does Glitch support async functions

Hello everyone,

Does Glitch allows async functions? I tried for the 1st time today, and when launching index.js in the terminal, I got the following error message:

async function countUrls() {
SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:387:7)
    at startup (bootstrap_node.js:153:9)

Thank you!

Yes, for example!/async-await-playground. Perhaps check which version of Node your app is using in package.json - it’ll need to be Node 7.6 up for async.


Thank you @Gareth ! This worked. I added the following in package.json:

  "engines": {
    "node": "8.x"


1 Like