Skip to content
Advertisement

“Parsing Error: unexpected token function” on Async Function with a recent Node version [closed]

I am working on a side project, using node and firebase.

I can create regular functions and cloud functions, but when I try to create an async one like this :

 async function getApartments(){...}

I have this error : “ESLint: Parsing error: Unexpected token function”

I saw on others posts (here) this can be linked to using Async functions on an old version of node, but since I’m on a recent version of node (17.8) I really don’t understand the problem.

Thanks in advance,

Advertisement

Answer

Good morning, Do you use eslint ? if yes ->

{
"parserOptions": {
    "ecmaVersion": 2017 @see https://eslint.org/docs/latest/user-guide/configuring/language-options
}
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement