代码之家  ›  专栏  ›  技术社区  ›  Vik

firebase函数https.onrequest with async失败eslint

  •  0
  • Vik  · 技术社区  · 7 年前

    我有FireBase功能

    exports.oauth = functions.https.onRequest(async (request, response) => {
    

    对于它,eslint抛出错误如下

      11:69  error  Parsing error: Unexpected token =>
    
    ✖ 1 problem (1 error, 0 warnings)
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! functions@ lint: `eslint .`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the functions@ lint script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    

    这里有什么问题?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Doug Stevenson    7 年前

    云函数目前运行节点6,它不支持EcmaScript 2017中的异步/等待语法。如果您想使用async/await,那么您应该使用typescript或其他类似的代码,这些代码可以追溯到在节点6上运行的等效代码。