async await with nodejs 7

前端 未结 1 1710
粉色の甜心
粉色の甜心 2021-01-05 04:26

I\'ve installed nodejs 7.3.0 and I have this code:

let getContent = function (url) {
    // return new pending promise         


        
相关标签:
1条回答
  • 2021-01-05 05:06

    Node 7.3.0 does not support async/await without a feature flag. Spawning node like this should do the trick:

    node --harmony-async-await app.js
    

    EDIT

    Node now officially supports async/await by default in version 7.6.0, which comes from updating V8, Chromium’s JavaScript engine, to version 5.5.

    0 讨论(0)
提交回复
热议问题