Async/await nodejs Syntax Error (IDE problem)



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')


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 !


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


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