Async/await nodejs Syntax Error (IDE problem)

nodejs
ide

#1

hello
i want to use async/await in my app, basically for querying my db

i have this function :

async function getVariables() {

var id = await Service.getIdByName('JollyClick')

console.log(id)

}
which is supposed to call this :

serviceSchema.statics.getIdByName = async function getIdByName (serviceName) {

this.findOne({name :serviceName }).exec().then(function(service){
    return service._id
})

}
but i get an error :

async function getVariables() {
^^^^^^^^

SyntaxError: Unexpected token function
i am using node v9

its seems to be a problem with the IDE
because it works when i run it through the terminal
please help me !


#2

How did you install node9? this can happen if default version of node is still old


#3

yes you are right, the default version is too old, how do i change it ? i tried nvm alias default , it didnt work
the default version doesnt change