Reputation:
I am trying to add async
method on node.js v6.11
but i, getting Unexpected identifier
error.
let fs = require('fs');
let Config = require('../somefolders/config.js');
module.exports = class SomeClassName {
constructor(id = null) {
}
//Some other methods
static async test1234(param) {
}
//Some other Static methods
}
This is the error We are getting:
Upvotes: 2
Views: 151
Reputation: 1075039
The error in the screenshot tells us you're using an old version of Node.js that doesn't have async
/await
support. Node.js has had async
/await
for years, but if I go back to v7, I can replicate exactly the error in your screenshot.
If you update to an up-to-date version of Node.js (or even a vaguely-recent one), that code is just fine.
Upvotes: 2