How to use `async` and `await`


Is there any way to use async and await in glitch code? The most obvious ways are to use Babel or to use Node v7.6.0, but I don’t think Glitch supports either of those.


Yeah, I think we only have Node up to v7.5 available atm (see below!), but you should be able to use harmony flags, like node --harmony-async-await app.js to enable it. Other folks have been playing around with Babel too!/babel-latest


As Gareth said :slight_smile:

To be more precise, you can currently use up to Node 7.7.3. To set the Node version, you can specify it in your package.json.

These are the installed versions:

7.7.3 7.6.0 7.5.0 7.4.0 7.3.0 7.2.1 7.1.0 7.0.0
6.10.0 6.9.5 6.8.1 6.7.0 6.6.0 6.5.0 6.4.0 6.3.1 6.2.2 6.1.0 6.0.0
4.7.3 4.6.2 4.5.0 4.4.7 4.3.2 4.2.6 4.1.2

As you can see, we have each <major>.<minor> version, and the latest patch version for each of them. You can also specify the version using only the major or only the major and minor numbers, like this: 7.6 or 6.


Possible bug report: If I specify 6.10.1 (which is, as I type this, what recommends as the latest LTS version) then Glitch, according to the Activity Log, goes with 6.9.5 instead.

Sounds like I can make that mostly moot by just specifying “6” or “6.10” in my package.json and Glitch will use the latest installed 6.*.* or 6.10.* version, which at the moment is 6.10.0 (but maybe ought to be 6.10.1).


Hi dreeves,

yes, we are aware of the problem – we have still to figure out how to solve it correctly.

thank you for the report! :slight_smile:


@etamponi @Gareth OMG it worked, thanks for your help! I just needed to update this part in my package.json:

"engines": {
  "node": "7.7.3"


Hey dreeves,

we fixed the versioning problem. Now specifying a patch version that does not exists causes Glitch to pick the latest patch version, but it keeps both the major and minor :slight_smile: Let me know if it works well for you!

(Caveat: older projects which didn’t go to sleep yet might not have picked the changes. We tend to forcefully restart projects only to pick major/breaking changes).

PS: and we updated Node to 7.7.4 and 6.10.1


Confirmed! Thanks so much!